Click here to Skip to main content
15,886,519 members
Articles / Programming Languages / C#

Single Sign-on in ASP.NET and Other Platforms

Rate me:
Please Sign up or sign in to vote.
4.90/5 (42 votes)
7 Jul 2008CPOL8 min read 320K   7.8K   204  
Discuss the concept of single sign-on using Forms authentication within ASP.NET as well as other platforms.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        //call SetAuthCookie method to log in. A cookie is created. 
        //Domain name in the cookie defaults to the subdomain where the application resides
        FormsAuthentication.SetAuthCookie(txtUserName.Text, false);
        Response.Redirect("ProtectedPage.aspx");
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
Web & Database Developer. Design and implement web and database applications utilizing Microsoft and other development tools.

Comments and Discussions