About Andras Nemes
I'm a .NET/Java developer living and working in Stockholm, Sweden.

2 Responses to Introduction to Forms based authentication in .NET4.5 MVC4 with C# Part 2

  1. Subash says:

    Thank you for these articles…i’m learning a lot as the step by step approach you follow to explain is very very clear… however having said that i have a question in one of the above steps.
    Under the register action method there is 2 lines of code as you mentioned
    WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
    WebSecurity.Login(model.UserName, model.Password);

    You also said that after the login is verified the WebSecurity.Login() method logs in the user to the web application. I was wondering how did it redirect to the HomeControllers Login Action method when there is no such call in the WebSecurity.Login() method

    and also the next line of code after that is actually
    return RedirectToAction(“Index”, “Home”);

    • Andras Nemes says:

      Hi Subash,

      It’s the call to return RedirectToLocal(returnUrl); that does the redirect if the login is successful. If not then an exception message is attached to the model in the ModelState.AddModelError call.
      //Andras

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

ultimatemindsettoday

A great WordPress.com site

Elliot Balynn's Blog

A directory of wonderful thoughts

Softwarearchitektur in der Praxis

Wissenswertes zu Webentwicklung, Domain-Driven Design und Microservices

Technology Talks

on Microsoft technologies, Web, Android and others

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

WEB APPLICATION DEVELOPMENT BEST PRACTICES WITH MICROSOFT STACK & ANGULAR

Cyber Matters

Bite-size insight on Cyber Security for the not too technical.

Guru N Guns's

OneSolution To dOTnET.

Johnny Zraiby

Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

%d bloggers like this: