asp.net-mvc

ASP.NET MVC - Manipulating HTTP Post

When a form is posted back to the server, is it possible to manipulate, change, set the values contained in HTTP Post in the controller action? I would like to remove certain textbox values entered by the user so that these values always have to be re-entered (e.g. password fields). By default Html helpers extract initial values for HTML...

ASP.net MVC Routes

Hi guys, I am currently creating a mobile version of my company's site and using it as a time to learn asp.net mvc. The URLs which I'm meant to be creating are as follows Jobs/in/location Jobs/for/jobTitle Jobs/in/location/for/jobtitle jobs/for/jobtitle/in/location Now the more types we add the more I'll need to add and differ...

problem with AJAXToolKit under ASP.NET MVC

hello, i am using the AjaxToolKit in my MVC Application as shown on http://stephenwalther.com AutoComplete & the Calender are working fine but i cant pass properties to the js part. my generated javascript looks like this <script type='text/javascript'> Sys.Application.add_init(function(){ $create(AjaxControlToolkit.CalendarBehavior,{...

ASP.NET MVC - Image Upload Failing

Got a simple form, posting to an action... the action takes the data and creates a record in the DB, and copies the image to a directory. Works great on my local dev box. Upload the form to my host, and the image uploading doesn't work. The form acts as if it's failing the UpdateModel(), but doesn't show any validation messages. Anyone...

Availability of ROR flash functionality in ASP.Net-mvc

Does Microsoft MVC make available a mechanism comparable to RubyOnRails internal storage container known as flash? The preference would be not using UpdatePanel tricks. ...

Problem publishing an MVC app on IIS6

I have a small MVC app that works locally, but when I publish it to the server (running IIS6), all the links get messed up. For example, a typical link when running locally would be: http://localhost:3467/Exceptions?exdate=20090108 However, when I publish it to our dev server at \\deverserver\apps\MyProject, note the duplication in t...

Custom validation summary

I'm using the UpdateModel method for validation. How do I specify the text for the error messages as they appear in the validation summary? Sorry, I wasn't entirely clear. When I call UpdateModel(), if there is parsing error, for example if a string value is specified for a double field, a "SomeProperty is invalid" error message is au...

ASP.NET MVC - MapRoute versus routes.Add (and 404s)

I'm just getting started with ASP.NET MVC. What is the difference between MapRoute and routes.Add ? Should I just be using MapRoute? Can I map multiple routes? Which "maps" take precedence... those you called first or last? I'd like to be able to do something similiar to the StackOverflow does for users. But I would like the URL to fit...

How to repeat the same ASP.NET MVC action again?

I have an action called List that shows the results of a search. It receives parameters through the querystring because they are optional. My method signature looks like this: public ActionResult List(List<int> categoryIDs, string school, int? stateID, int? page) CategoryIDs is a multi-select box and I am doing everything over a GET r...

ASP.NET MVC - Response.Write code - put it in the Controller, SingleFile or CodeBehind

If you are going to be generating a page as a string and outputting all the content via Response.Write at the last minute where should you put this code? I need to be able to dynamically write a bunch of JavaScript to the client to use some of the new Google visualization jsapi. I noticed this last release of the MVC framework "discour...

"Remember me" with ASP.NET MVC Authentication is not working

I have a standard ASP.NET MVC (RC Refresh) web project, with the standard ASP.NET Membership provider and the Account controller that is included in the project template. When I check "Remember me" in my Login form, I am still not being remembered by the site. (Firefox remembers my username and password, but what I expected to happen wa...

Modelbinding database entities in ASPNET MVC

I'm having trouble trying to think what the best way is to recreate a database object in a controller Action. I want to make use of ModelBinders so in my action I have access to the object via a parameter, rather than having to repeat code to get an object from the database based on an identifier parameter. So I was thinking of having a...

Is it possible to send more than one model object to an ASP.NET MVC View?

On my start page, I'd like to display the first items from several different lists that i have on other pages - somewhat like the "recent" page here on SO displays both recent posts and recent comments. In my case I want to list the two most recent posts in a guest book, and the next upcoming event. In order to do this, how can I pass ...

ASP.NET MVC getting user variables

Just getting started using MVC in ASP.NET, I'm going to have it so users must login to use certain features. Now I have a User controller that stores users in a table and another controller that adds data to another table. Once the user is logged in, how would I get their id from the user table from within the add controller in order to ...

How to leave URL parameters unescaped in ASP.NET MVC?

I've noticed the returnurl URL parameter on the Stackoverflow login/logout links are not escaped but when I try to add path as a parameter to a route it gets escaped. So /login?returnurl=/questions/ask shows /login?returnurl=%2fquestions%2fask and it's kind of ugly. How do I get it to not escape the returnurl value? Here's what I'm do...

How does the controller pass information between the model and the view?

In ASP.NET MVC, how does the controller pass information between the model and the view? Let's say I have a list of baseball players in my database. After I query those players using LINQ in the controller, how do I then pass this information on to view (my list of baseball players and their stats)? And after I pass them onto the view...

Visual Studio 2008 SP1 crash when opening MVC View

I have Visual Studio 2008 SP1 and ASP.NET MVC RC installed on a XP SP2 machine with .NET Framework 3.5 SP1. (That's a lot of SP's in one sentence!) I've a ASP.NET MVC project that I can edit just fine with Visual Web Developer Express. But opening a View page in Visual Studio 2008 SP1 makes Visual Studio to crash and vanish without even...

View-specific Models in ASP.NET MVC?

I am relatively new to MVC, so this is likely a novice question. I am trying to understand the best practices for how to maintain clear separation of concerns in a few scenarios that don't appear straightfoward. There are two scenarios I am looking at right now. Imagine a very basic app that lets users view and edit online profiles fo...

Linq Expression Confusion combined with defered execution

I'm trying to figure out a way of getting a particular piece of code called when a path is recognised. I'm going to be registering paths from different plugins. This allows them to fight over the paths that they want. The idea being that the plugins say here are the paths that I'm interested in, when you get a match create an instance o...

How do you do validation in ASP.NET MVC RC?

Does ASP.NET MVC provide a standard validator functionality or do you have to create your own validation manually? If the latter, is there any third party validator available that you can use on ASP.NET MVC web applications? ...