![]() |
Thread was being aborted
Hi,
When I do the Login using the code below I am getting the System.Thread.ThreadAbortException(Thread was being abortefd) on the last line of the below code i.e. Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent)); there is no original URL, therefore it is returning Default.aspx. I don't know why I am getting the above exception. private void ButtonLogin_Click(object sender, System.EventArgs e) { string sessionID = ""; string uID = txtUsername.Text; string pwd = txtPassword.Text; bool isPersistent = false; try { ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out sessionID); string userData = sessionID; switch(loginResult) { case ESMLoginResultEnum.OK: { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path); // Encrypt the ticket. string encTicket = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket); cookie.Path = FormsAuthentication.FormsCookiePath; // Create the cookie. Response.Cookies.Add(cookie); // Redirect back to original URL. Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent)); break; } } } } Regards, Ekta |
RE: Thread was being aborted
Hi,
I had the same problem and I resolved it in this way. I modified the session as stateServer or Sql Server or I have turned off the antivirus on the directory InetPub anf for ASP_wp.exe and aspnet_state.exe processes. In fact , the antivirus, invalidate the session end the thread get aborted. I hope to help you By "enahar" wrote: > Hi, > > When I do the Login using the code below I am getting the > System.Thread.ThreadAbortException(Thread was being abortefd) on the last > line of the below code i.e. > Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent)); > > there is no original URL, therefore it is returning Default.aspx. > > > > I don't know why I am getting the above exception. > > > > > > private void ButtonLogin_Click(object sender, System.EventArgs e) > > { > > string sessionID = ""; > > string uID = txtUsername.Text; > > string pwd = txtPassword.Text; > > > bool isPersistent = false; try > > { > > ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out > sessionID); > > string userData = sessionID; > > switch(loginResult) > > { > > case ESMLoginResultEnum.OK: > > { > > FormsAuthenticationTicket ticket = new > FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path); > > // Encrypt the ticket. > > string encTicket = FormsAuthentication.Encrypt(ticket); > > HttpCookie cookie = new > HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket); > > cookie.Path = FormsAuthentication.FormsCookiePath; > > // Create the cookie. > > Response.Cookies.Add(cookie); > > // Redirect back to original URL. > > Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent)); > > > > break; > > } > > } > > } > > } > > > > Regards, > > Ekta > > > > > |
RE: Thread was being aborted
The Redirect docs say:
Remarks Redirect calls End which raises a ThreadAbortException exception upon completion. "enahar" wrote: > Hi, > > When I do the Login using the code below I am getting the > System.Thread.ThreadAbortException(Thread was being abortefd) on the last > line of the below code i.e. > Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent)); > > there is no original URL, therefore it is returning Default.aspx. > > > > I don't know why I am getting the above exception. > > > > > > private void ButtonLogin_Click(object sender, System.EventArgs e) > > { > > string sessionID = ""; > > string uID = txtUsername.Text; > > string pwd = txtPassword.Text; > > > bool isPersistent = false; try > > { > > ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out > sessionID); > > string userData = sessionID; > > switch(loginResult) > > { > > case ESMLoginResultEnum.OK: > > { > > FormsAuthenticationTicket ticket = new > FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path); > > // Encrypt the ticket. > > string encTicket = FormsAuthentication.Encrypt(ticket); > > HttpCookie cookie = new > HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket); > > cookie.Path = FormsAuthentication.FormsCookiePath; > > // Create the cookie. > > Response.Cookies.Add(cookie); > > // Redirect back to original URL. > > Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent)); > > > > break; > > } > > } > > } > > } > > > > Regards, > > Ekta > > > > > |
Re: Thread was being aborted
Hi,
I am no more getting the exception of System.Thread.ThreadAbortException(Thread was being abortefd) But still the Session is still not timing out when there is no activity by the user for 15 minutes.What is wrong I am doing it.Please suggest. I am writing the following code in the web.config file and the Login.aspx.cs for the sessiopn TimeOut and for the forms authentication ticket timeout. Also I am writing the following code in the Body tag of the Login.aspx page <meta http-equiv="Refresh" URL="../Security/Login.aspx> even then Session is still not timing out when there is no activity by the user for 15 minutes.What is wrong I am doing it.Please suggest. code in the session_end is as follows: protected void Session_End(Object sender, EventArgs e) { FormsAuthentication.SignOut(); if (Session["SessionID"] != null) { try { ESMSecurityModule.killSession(Session["SessionID"].ToString()); } catch { } } } WEB.CONFIG <authentication mode="Forms"> <forms loginUrl="../Security/Login.aspx" protection="All" timeout="15" path="/" /> </authentication> and for the forms authentication ticket TimeOut I am writing the following code in the Login.aspx page: LOGIN.ASPX PAGE FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(15),false,userDat a,FormsAuthentication.FormsCookiePath); // Encrypt the ticket. string encTicket = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket); cookie.Path = FormsAuthentication.FormsCookiePath; // Create the cookie. Response.Cookies.Add(cookie); // Redirect back to original URL. Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent),false); Regards, Ekta "Scott Allen" <scott@nospam.odetocode.com> wrote in message news:l3vo21hihtmb3pauqj9sphjqorb7v225fk@4ax.com... > On Mon, 7 Mar 2005 17:09:01 +1100, "enahar" <enahar@hotmail.com> > wrote: > >>Hi, >> >>Session is still not timing out when there is no activity by the user for >>15 >>minutes. >> >>My web.config settings are as below. >>also in the login page for the ticket I am adding 15 minutes. >> >> >>What is wrong i am doing it.. >> >> >>Regards, >>Ekta >> >> > > Hi Etka: > > Are you testing the Session timeout or the forms authentication ticket > timeout? > > -- > Scott > http://www.OdeToCode.com/blogs/scott/ > "Alessandro Zucchi" <AlessandroZucchi@discussions.microsoft.com> wrote in message news:18F57BBD-38D0-4EF1-8F55-D0BA6A4462E1@microsoft.com... > Hi, > I had the same problem and I resolved it in this way. > I modified the session as stateServer or Sql Server > or > I have turned off the antivirus on the directory InetPub anf for > ASP_wp.exe > and aspnet_state.exe processes. > In fact , the antivirus, invalidate the session end the thread get > aborted. > I hope to help you > By > > "enahar" wrote: > >> Hi, >> >> When I do the Login using the code below I am getting the >> System.Thread.ThreadAbortException(Thread was being abortefd) on the last >> line of the below code i.e. >> Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent)); >> >> there is no original URL, therefore it is returning Default.aspx. >> >> >> >> I don't know why I am getting the above exception. >> >> >> >> >> >> private void ButtonLogin_Click(object sender, System.EventArgs e) >> >> { >> >> string sessionID = ""; >> >> string uID = txtUsername.Text; >> >> string pwd = txtPassword.Text; >> >> >> bool isPersistent = false; try >> >> { >> >> ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out >> sessionID); >> >> string userData = sessionID; >> >> switch(loginResult) >> >> { >> >> case ESMLoginResultEnum.OK: >> >> { >> >> FormsAuthenticationTicket ticket = new >> FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path); >> >> // Encrypt the ticket. >> >> string encTicket = FormsAuthentication.Encrypt(ticket); >> >> HttpCookie cookie = new >> HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket); >> >> cookie.Path = FormsAuthentication.FormsCookiePath; >> >> // Create the cookie. >> >> Response.Cookies.Add(cookie); >> >> // Redirect back to original URL. >> >> Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent)); >> >> >> >> break; >> >> } >> >> } >> >> } >> >> } >> >> >> >> Regards, >> >> Ekta >> >> >> >> >> |
| All times are GMT. The time now is 12:37 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.