Sunday 15 May 2011

c# - Want to make user login on button click with out using asp login control -


I want to login the user after signing up. My problem is that the user has entered more details after signing up and I want to login automatically to him. But when I login to the code in the code, login status and login name is not showing anything, the user has not signed in.

My code for user login is as follows:

  subl.LoadByLogin (ds, txtUserName.Text.Trim (), txtPassword.Text.Trim ()); // BULL YUDUSUSERNAME = Login Username Remember Metset; If (ds.Tables.Count & gt; 0 & amp; amp; amp; amp; amp; amp; amp;; Databases [0] .Rows.Count & Gt; 0) {session-Context.SystemUser = WebHelper.Cast (ds.Tables [0] .owsows [0] ["SystemUser"], 0); Session Contex SystemUserX = DTTables [0] .Row [0] ["First Name"] + "" + DTTables [0] .Row [0] ["Last Name"]; Session Context.uper Admin - WebHelper.Cast (DTTables [0] .Row [0] [["ISUPERAdmin"], Incorrect); Session consultant website administrator = webhalper Cast (DSTibles [0]. Rao [0] ["ISAT Admin"], False); Sessioncontext It's Travel Agent = WebHalper Cast (DSTibles [0]. Roov [0] ["IterGurge Agent"], False); Session syntax Travel Agent IDI = WebHalper Cast (DSTibles [0]. Roov [0] ["TravelAgeintIDID"], 0); Sessioncontext ISMmail = WebHalper Cast (DSTibles [0]. Roov [0] ["Ismember"], Incorrect); SessionContext.PropertyID = WebHelper.Cast (DSTB [0] .Rao [0] ["PropertyID"], 0); Sessioncontext Member ID = WebHalper Cast (DSTB [0] .Row [0] ["MemberEid"], 0); Session kontax Regeda = WebHalper Cast (DSTB [0]. Roov [0] ["Reguid"], 0); Sessioncountx .site = webhalper Cast (DSTB [0]. [0] ["Site"], 0); // sessioncntx Reseller = DTTables [0] .Row [0] ["Property Name"]. Toasting (); If (session constellation. Top administrator) {// EditorContact = true; } // sessionContacts Ispublicester = webhalper Cast (DSTibles [0] .Rov [0] ["Ishpubilizer"], Incorrect); // Start formationAuthentication formsOfficerTiticketTickets = NewFormatTechnetTicket (1, session consoleSystemsUserXX, Datetime.Now, Datetime.Adminates (50), False, "Sparrow", FormattingFormQookPath); String Hashkiki's = Formas. Encrypt (ticket); HTTP cookie cookie = new HTTPQK (form accreditation. Formscookie, hashkuckies); Response.Cookies.Add (cookie);    

Use this:

  FormsAuthentication.SetAuthCookie ("Username", true);   

Response.redirect (somewhere.aspx) before calling in Login1_Authenticate;

This will set the user as a login. Username in the textbox login control for you

No comments:

Post a Comment