protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["UserId"] == null && Session["FromClient1Login"] == null) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["FromClient1Login"] != null) { struser = Session["Userid"].ToString(); lblMessage.Text = "Welcome " + struser + System.Environment.NewLine + " This Login is from Client 1 login"; } else if (Request.QueryString["IsAuthenticatedBySSO"] != null) { struser = Request.QueryString["UserId"].ToString(); SSOClient1DBDataContext db = new SSOClient1DBDataContext(); var _appSpecificUserName = (from u in db.Client1Maps where u.MainAppUserId == struser select u.C1AppUserId).ToList(); struser = _appSpecificUserName[0].ToString(); lblMessage.Text = "Welcome " + struser + System.Environment.NewLine + " This Login is from SSO"; } } }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup SSOClient1DBDataContext db = new SSOClient1DBDataContext(); if (!db.DatabaseExists()) { db.CreateDatabase(); } }
protected void LoginControl_Authenticate1(object sender, AuthenticateEventArgs e) { SSOClient1DBDataContext db = new SSOClient1DBDataContext(); var psw = (from c in db.Client1Credentails where c.UserId == LoginControl.UserName select c.Password).ToList(); string strPsw = psw[0].ToString(); Session["UserId"] = LoginControl.UserName; Session["FromClient1Login"] = "******"; if (strPsw == LoginControl.Password.ToString()) { Response.Redirect("~/Client1MainPage.aspx"); } }