Let the user authentication work at the BasePage, is it suitable?

B

Benny Ng

Hi,all,
Now I let every .aspx page inherited from BasePage, and let the
authentication work at there.
sample code:
if (session["user"]=="")
{
//Redirect to login page
Response.Redirect ("login.aspx");
}

is this method right? and suitable for the .NET development's habit?

Because this method is study from my traditional ASP development.(likes
included a authentication page in every ASP pages)

And now I prepare to used this style
"FormsAuthentication.RedirectFromLoginPage" authentication mode to do the
auth module.Any special things I need to take care?

And any suggestion are appreciated.

Thank you very much.

Benny Ng
 
D

darrenkopp

If you are using forms authentication and all pages in the application
require a user to be logged in, set the following up in your web.config
in the authentication section.

<configuration>
<system.web>
<authentication mode= "Forms">
<forms name=".SITEAUTH" loginUrl="Login.aspx" />
</authentication>
</system.web>
</configuration>

information about forms authentication can be found at
http://samples.gotdotnet.com/quickstart/aspplus/doc/formsauth.aspx.

-Darren Kopp
 
B

Benny Ng

Ah..Yes. I saw this before. Now i goto checkout this article.Thank you very
much.

Benny Ng
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top