Solved

LogonModel Question

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

22 Experts available now in Live!

Get 1:1 Help Now