Solved

LogonModel Question

Posted on 2014-04-14
2
148 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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