Thread was being aborted

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default 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




    enahar Guest

  2. Similar Questions and Discussions

    1. Error: Thread was aborted from WaitForSingleObject
      Hi, I've a WebApp that calls Microsoft CRM WebServices to perform a particular action. In my WebApp I am spawning a new async thread for all the...
    2. Newbie:Using ASP.NET thread pool thread to dispatch TCP data, etc.
      Hi, I've an ASP.NET web service which distributes events to clients via TCP. Environment is IIS6 on Windows 2003 server with .NET framework 1.1...
    3. [PHP-DEV] Ifx - Help ! losing my mind, thread by thread
      --------------010000080604040703060106 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, Please...
    4. DB2 Backup to TSM aborted
      Hi guys and girls, DB2 stopped backing up to TSm recently after adding parallel writes to copy storage pools. the diag logs read: ...
    5. ThreadAbortException: Thread was aborted exception???
      I've got a WebServices application that uses Crystal Reports to produce and then export Invoices to PDF format. Without getting into too many...
  3. #2

    Default 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
    >
    >
    >
    >
    >
    Alessandro Zucchi Guest

  4. #3

    Default 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
    >
    >
    >
    >
    >
    JayAchTee Guest

  5. #4

    Default 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
    > [url]http://www.OdeToCode.com/blogs/scott/[/url]
    >
    "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
    >>
    >>
    >>
    >>
    >>

    enahar Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139