C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Simple Authentication and registration process for a website through Membership schema


Posted Date:     Total Responses: 0    Posted By: dexter   Member Level: Gold   Points/Cash: 30   


As you can see today many of websites and web application need authentication for using that service.
you can create your own such web service which authenticates and creates new user using any database language.But what happens sometimes by mistakes you may make some mistakes which may make a security flaw to your website.
To avoid it you can use Membership schema provided by asp.net.so that errors to be made by you becomes zero.

So lets start.

1.Configuring Your Web Application.
If you are using visual studio 2008 when you create new website web.config file is automatically created else create a new web.config file in your project.
Now in Menubar go to ASP.NET configuration.select the security tab,select authentication type link.Then you will see two options.
a)From Internet.
b)From Local Network.

Select "From Internet" and press done.
save all.

2.creating Webpages and coding.

The Authentication Code is like this

if (Membership.ValidateUser(Login1.UserName, Login1.Password))
{
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, Login1.UserName, DateTime.Now, DateTime.Now.AddMinutes(50), Login1.RememberMeSet, "demo");
string hashticket = FormsAuthentication.Encrypt(ticket);

HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashticket);
Response.Cookies.Add(cookie);

string returnUrl = Request.QueryString["ReturnUrl"];
if (returnUrl == null) returnUrl = "~/Default.aspx";

Response.Redirect(returnUrl);
}


Benifits of this method:Less Coding,More inbuilt Security Features.

Attachments

  • Authenticaiondemo (688-10031-Authenticationdemo.zip)

  • Project Feedbacks


    No feedbacks found. Be the first to respond and make money from revenue sharing program.

    Post Feedback
    You must Sign In to post a feedback.
    Next Project: Library Management System
    Previous Project: online shopping portal

    Return to Project Index

    Post New Project


    Related Projects



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use