Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Security (http://www.velocityreviews.com/forums/f62-asp-net-security.html)
-   -   Thread was being aborted (http://www.velocityreviews.com/forums/t767212-thread-was-being-aborted.html)

enahar 03-07-2005 01:51 AM

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





Alessandro Zucchi 03-07-2005 10:05 AM

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
>
>
>
>
>


JayAchTee 03-07-2005 08:33 PM

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
>
>
>
>
>


enahar 03-08-2005 01:43 AM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57