Solved

LogonModel Question

Posted on 2014-04-14
2
149 Views
Last Modified: 2014-05-07
I'm using MVC 4, and I have hacked the logon/account stuff a bit to implement the old forms login, but all of a sudden the LogonModel seems to be null, or rather the line
@Html.TextBoxFor(m => m.UserName, new { @class = "form-control notAsTall" })

Open in new window

is throwing a null exception.
Its made me question where the LogonModel was getting instantiated anyway as the controller (out-of-the-box) just returns View()
0
Comment
Question by:Silas2
2 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 250 total points
ID: 40001291
>> the controller (out-of-the-box) just returns View()

This means Model would be null inside the views. Normally there are two Actions of same name, with and without model as parameters. The one without model is used to present initial form.
0
 

Author Comment

by:Silas2
ID: 40001311
What I've become curious about is where the LogOnModel is instantiated.
I see the other Action with two params, but I'm testing with another app I've got with an older scaffold/mvc framework and the param-less one is still instantiating the LogOnModel.
Is it instantiated in the pipeline before it reaches the controller?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question