Solved

LogonModel Question

Posted on 2014-04-14
2
139 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
crm development 2 64
Re-position the objects 7 95
Entity Framework 3 46
asp.net mvc return json 2 53
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

929 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now