why should i use FormsAuthentication.RedirectFromLoginPage
(); Method in Form Authentication?Without using this method
also it's good??

Answer Posted / uday kumar vuriti

FormsAuthentication.RedirectfromLoginPage() redirect the
user to the requested page without redirecting to default page.

Assume that we have 4 Pages and we are using forms
authentication with Login Page as Login.aspx and default
Redirection after Login Page as Home.aspx

MyApp/Login.aspx
MyApp/Home.aspx
MyApp/Profile.aspx
MyApp/Inbox.aspx

With FormsAuthentication.RedirectfromLoginPage():

If user requested for MyApp/Profile.aspx with out
Authentication Cookie(Login), he will be redirected to Login
Page and then after Login he will be redirected to
MyApp/Profile.aspx.

With out FormsAuthentication.RedirectfromLoginPage():

If we are not using
FormsAuthentication.RedirectfromLoginPage() then If user
requested for MyApp/Profile.aspx with out Logging in, he
will be redirected to Login Page and then after Login he
will be redirected to MyApp/Home.aspx.


the difference here is direct redirection of user to the
requested page.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different session state management options available in asp.net?

510


What is routing in MVC?

589


What does it mean your session has timed out?

521


What are the ways of preserving data on a Web Form in ASP.NET?

614


Can you explain page lifecycle in net?

503






What is aspect-oriented programming?

535


What are the asp.net security controls?

546


Explain swagger components.

560


Can you change a master page dynamically at runtime? How?

497


Explain method to handle error using HttpError in Web API?

574


What are url fragments?

494


Define viewstate in .net?

538


If there are multiple update panels on the page say upd1 and upd2. There is a button placed in upd1. How can you stop upd2 to update when button placed in upd1 is clicked?

563


What is postback in asp net?

562


What is the purpose of session management?

504