asp.net-mvc

How to overcome the Model → ViewModel impedance mismatch?

I'm baffled. I have my linq-to-sql model which is a mirror of a database table (Id, CustomerId, RegionId,...N), nothing interesting, all foreign keys. Now I need to view this data in my asp.net view. I create a ViewModel (Id, CustomerId, Customer, RegionId, Region, CustomersSelectList, RegionsSelectList). Clearly, the viewmodel ...

ASP.NET MVC Controller Lifecycle

It's my understanding that the constructor for a controller is not called during each web request. Assuming this is true, what is the lifecycle of a controller? Is is "constructed" upon app start, then cached and invoked with the requestcontext injected into it with each web request? Just to be clear, I'm not asking how to emulate const...

Minimum RAM for a simple ASP.NET MVC web application

I know it depends, but I am just curious what specifications others are using to run a simple site with a MS SQL Server back-end. What is recommended for the application, not the database? ...

Html ValidationMessage not working since upgrade to ASP.NET MVC 2 Beta

I have an update controller action that checks validation. if (!ModelState.IsValid) return View(InitialiseModel(model)); My view uses UIHelpers: <%=Html.EditorForModel("MyModelTemplate") %> I have a String property in my model called "Title" which has the attribute [Required]: [Required] [DisplayName("Resource title")] public s...

Keep session alive forever as stackoverflow

I need to keep the session live unless until the user clicks logout in my asp.net mvc(C#) application. When the user closes the browser and opens again, the session should continue with the values. I am trying to implement as in stackoverflow. Any ideas/suggestions? ...

What is the best approach to take for user profiles in my web application?

I'm currently building an ASP.NET MVC web application. My site security is (currently) built atop an extension of the System.Web.Security Membership model where I've extended: AuthorizeAttribute MembershipProvider RoleProvider This has sufficed for the security mechanism - although it has complicated a lot of things I could probably...

How to display a matrix in Html

Hi. I have 3 classes: class R{ string NameR;} class A{ string NameA;} Class RP { R objR; A objA; bool result; } I use NHibernate so in DB I have a table RP: [Id] [int] IDENTITY(1,1) NOT NULL, [Result] [bit] NULL, [RId] [int] NULL, [AId] [int] NULL I need to display in my view a matrix like this: __ A1 A2 A3 R1 1 ...

asp.net mvc webforms like gridview

is there a grid for asp.net mvc that acts just like the asp.net webforms datagrid the behavior that I need is to pass to the grid a DataTable without specifying the amount of columns ...

How to add a view for current user details in MVC?

MVC 2, so I do not know if it is different. I am trying to add a page so that when a user is logged in, they click on their username at the upper right of the page, and it takes them to a page showing their details (email, change password link, profile information, etc..). I am trying to use the aspnet MembershipService to do this. ...

ASP.NET MVC Web Config Email Settings

I'm trying to include some SMTP settings in my ASP.NET MVC project by adding the following to my Web.Config file: <system.net> <mailSettings> <smtp> <network host="host" port="25" userName="username" password="password" /> </smtp> </mailSettings> </syste...

VS 10 mangles html comments?

Using the latest VS 10 we created html markup, then commented it with html comments. The file on disk is not mangled, but when it renders, it renders the html comment tags, then removes some of the html markup within the commented tags: Two questions (1) why would it not like the html comment tags and (2) why would it change the html c...

how can i send data to server ...

Hi all, I am having ASP.NET MVC application in which i have to send data from client browser to the server. Client browser means that data is present in javascript function (calculated) now what should i use to send this data to server . Before MVC, in my old application i was using Web Methods Please advice ...

Calling an application from ASP.NET MVC

Im trying to see if it is at all possible to call an external (console) application from an ASP.NET MVC app. They will both be build and deployed on internal servers, and both will use a custom form of security, validating the user VIA AD before anything executes, so Im not overly worried about the security risks. Basically, Im trying t...

Html.ActionLink with an Image

Does anyone know of a decent way to cleanly use Html.ActionLink helper with an image instead of text without going through a huge amount of replace scripts and the like? ...

MVC, jquery, hoverIntent, Error: Object doesn't support this property or method

I am having one heck of a time with hoverIntent. I keep getting "Error: Object doesn't support this property or method" popping up. If I change .hoverIntent to .hover, it "works". I've tried the regular file and the minified file and neither work. I downloaded them from here I only have 2 scripts on the page. (this is in the MVC ma...

ASP.NET MVC fuzzy path to the pit of success?

I'm interested in adding ASP.NET MVC to my skillset. However my reticence comes from the fact that there seems to be a lot of "fuzziness" when people talk about implementing applications and how to adhere to the rules of the MVC architecture. I've heard Microsoft quoted as wanting developers to fall into the pit of success. With that ...

MVC Contrib Input Builders and Spark View Engine

In Eric Hexter's Input Builders, different templates use different strongly-typed models; for example String uses PropertyViewModel<object>, DateTime uses PropertyViewModel<DateTime>, Form uses PropertyViewModel[], and so forth. Spark View Engine doesn't seem to allow this, because all elements that compose the presentation (masters, vie...

Any way to create a catch all Route

I have many actions on a controller Controller1\Action1 Controller1\Action2 Controller1\Action3 Controller1\Action4 Controller1\Action5 Controller1\Action6 I would like my URLs to always be just: Action1 Action2 Action3 Action4 Action5 Action6 Is there an easy way to do this? I won't have any conflicts where: Controller1\Action1 ...

Interface 'System.Web.Mvc.IValueProvider' cannot be indexed because it has no default property

This used to work. <AcceptVerbs(HttpVerbs.Post)> _ Function Widget(ByVal collection As FormCollection) As ActionResult ... If ... Then ModelState.AddModelError(...) ModelState.SetModelValue("Gadget", collection.ToValueProvider("Gizmo")) Return View() End If ... End Function I upgraded to ASP.NET...

Why won't SubSonic ActiveRecord update my data?

I am playing around with SubSonic 3 ActiveRecord. I have a table called Users and I have the following fields in a MySQL database: CREATE TABLE `users` ( `ID` int(10) NOT NULL auto_increment, `Username` varchar(50) NOT NULL, `FirstName` varchar(50) default NULL, `LastName` varchar(50) default NULL, `EmailAddress` varchar(10...