asp.net-mvc

Custom errors override in ASP.NET MVC area

I would like to have custom error pages unique to an MVC area. Unfortunately, it appears that the Web.config override system doesn't take the MVC folder structure into account. If I want to override an area called "mobile", I have to create a root project folder (in with Views and Controllers) named "mobile" and put the Web.config in the...

ASP.NET MVC FileContentResult SLOW

We are using it to return a file for an export. When we run this export on a lot of records, it takes close to 10 minutes to run. Here is a code snippet of the code that actually calls the File() method and returns the result. Public Function Export(ByVal ID As Integer) As FileContentResult Dim str As String = String.Empty Dim data(...

Is it possible to share a Master Page between projects?

We have several different MVC2 projects on the go and I would like to be able to share a single master page between them. Is there an easy way to do this without recreating the same master page in each project? ...

deploying asp.net mvc app to iis7 .net 4.0 environment, images and css don't load

I am following the steps listed here: http://msdn.microsoft.com/en-us/library/dd483478.aspx at the bottom of that page are steps to manually migrate a web.config from .net 3.5 to 4.0 Currently, the site loads and routes fine, except for static data - images, css.. everything in the migration guide works fine, except : "7.Delete everyt...

asp.net mvc: read route param inside controller

I'm trying to read the a parameter that I've defined in a route from inside the controller. The route: routes.MapRoute( "BusinessVoice", // Route name "business/{controller}/{action}/{id}", // URL with parameters new { controller = "Voice", action = "Index", id = UrlParameter.Optional, locale = "business" } // Parameter defaults ); F...

How can I close one jQuery UI Dialog and focus on another?

After my call to $.ajax(), all UI Dialogs currently close and the page appears to do a full postback as per firebug--this is not what I want. I want the List ** UI Dialog** (read: partial view) visible, then the "Create" button is pressed to open another UI dialog for creating an address. I want to ajax post the data (preferably strongly...

Why does my Web Deployment Project remove .ascx files from my MVC2 project?

Hi Experts, I am currently working on a project that consists of an ASP.NET MVC 2.0 front end and has been developed in VS 2008. I have been messing around with the Web Deployment Project to deploy the application so we can also change various Web.config settings based on the build configuration. However, when the deployment project pu...

problems with GoogleBot

My site on MVC. If I use authentication mode="Windows" GoogleBot indexes site. If I use authentication mode="Forms" what I'm finding is that when I use Google's Webmaster Tools to fetch my site (to see what a GoogleBot sees) it sees this. HTTP/1.1 302 Found Content-Type: text/html; charset=utf-8 Location: /Products/Trouble?aspxerrorpat...

In MVC, one Edit HttpPost is working, the other one isn't. What am I missing?

Googling generally and on SO hasn't helped me yet, so: I am building my first MVC application from scratch, going by the MVC Music Store example but instead building a little application where arena Fighters can be created and made to Fight each other. (Fighters and Fight have been made linked to underlying tables through EF). I have ...

How should I notify the user that an action was successful?

Reading from this blog by Stephen Walther, I'd like to have my Create view post to my Insert action. Stephen suggests that after my Insert action is done, to redirect to the user to another action. I guess I could redirect them to the Detail view of the object they just created, but I'm curious to know if there are other strategies to ...

How to Inject HTML on ASP.NET MVC master page

I have a simple, but probably common problem on how to inject HTML inside an ASP.NET MVC master page. I have a google analytics tracking code that sits on my master page. The code looks like this: var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-1']); _gaq.push(['_trackPageview']); // need to inject ecommerce code here (functi...

How do you define the login page you want unauthorized user to be redirected to

I have decorated my controller with an Authorize attribute, as so: [Authorize(Roles="ExecAdmin")] If I try to go to that controller after logging in as a user who is not ExecAdmin, it does appear to be attempting to redirect to a login page. BUT, the page it is attempting to redirect to is not my login page, it is a view called LogOnU...

Do ASP.Net MVC Controller Attributes Execute Before or After the Action?

Consider the following code: [Authenticate(Order = 1)] public ActionResult SomeActionThatRequiresAuthentication() { var model = new SomeViewModel(); // Do something with an authenticated session/user... return View(model); } Does the Authenticate attribute happen before or after the code insid...

What can WCF WebHttp do that ASP.NET MVC cannot?

Please, no "They solve 2 different problems" answers, it's the same HTTP request and response problem. Just because you have views/templates in MVC doesn't mean you have to use them. M_C is good enough for serving XML and JSON. Please, no "It's what Microsoft says you should do" answers. If I thought that way I wouldn't be asking this q...

How much effort would it take to build a web store in ASP.NET MVC?

Another slightly non-technical question, but I couldn't decide whether to ask here or on Server Fault... I can't say I'm an MVC guru yet, but I've built several LOB applications so far in ASP.NET and WPF/Silverlight and am currently working on one in MVC 2, so I do know my way around for the most part. My concern is more about the accou...

edmx populating mdf?

when i 'generate database from model' in an edmx file it asks for a datasource and generates a sql file and adds the data source to the app.config if i choose sqlserver as the source it works fine and i can either use an existing database or create a new one and the tables get populated to it and its ready to use possible to make that ...

ASP.Net MVC vs Web Forms what are the benefits of one over the other

Possible Duplicate: MVC versus WebForms Was curious what the main benefits of going MVC over Web Forms. I write everything in web forms currently but I already enforce a pretty strict separation on myself would I see any benefits from moving to MVC? Currently I use jquery for my AJAX; calling Page Methods and Web Services....

How to check the Condition here..

<script type="text/javascript"> $('#TextEdit').click(function () { $('#ObnAdd').val('Save'); }); </script> <% using (Html.BeginForm("Create", "ObnTextComponents",FormMethod.Post,new {@id = "TheForm"})) {%> I need to check the condition if my ObnAdd Button text is Add need to go Create ActionResult if ...

MVC 2.0 Elmah The page cannot be found IIS 6

I have MVC 2.0 web application and different development and testing environments on dev IIS 7.5 - x64 on testing IIS 6.0 - x86 I am configured elmah to work on dev but i cant get it work on testing. I have all config sections from elmah in place for both environments. On dev Elmah not working (logging not working) and when i am reques...

Routing based on requested datatype in ASP.NET MVC

I'm trying to write REST-behaviour into my ASP.NET MVC2 app, but I'm having a hard time figuring out how to make the routes work as I want. I'd like my routing to work like this: /Users/Get/1 <- returns a regular HTML-based reply /Users/Get.xml/1 <- returns the data from Get as XML /Users/Get.json/1 <- returns the data as JSon I've t...