Click here to Skip to main content
16,014,650 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void btnSubmit_Click(object sender, EventArgs e)
       {


           try
           {


               User clsUser = null;

               if (this.Userid.Text == "")
               {

                   this.Userid.Focus();
                   throw new Exception("Please Enter User Name");

               }


               if (this.txtPssword.Text == "")
               {
                   this.txtPssword.Focus();
                   throw new Exception("Please Enter Password");
               }

               clsUser = m_SecuritySys.checkUser(this.Userid.Text, m_SecuritySys.EncrypyPassword(this.txtPssword.Text));

               if (clsUser != null)
               {

                   if (clsUser.intStatus == 2 || clsUser.intStatus == 3)
                   {

                   }
                   else
                   {
                       Session["userid"] = clsUser.strUserId;
                       Session["username"] = clsUser.strUserName;
                      // Session["userstream"] = clsUser.userStream;


                        Response.Redirect("~/Default.aspx",true);

                   }
               }
               else
               {
                   Userid.Focus();
                   throw new Exception("Invalid user entry, Please try again");
               }
           }
           catch (System.Threading.ThreadAbortException ex)
           {
               DisplayCustomMessage(ex.Message);
           }

           finally
           {
               if (connection != null)
                   connection.Dispose();
           }
Posted
Updated 27-Oct-15 1:52am
v2
Comments
Suvendu Shekhar Giri 27-Oct-15 7:56am    
Have you tried debugging?
In which line of the code are you getting this exception?
Is it "Response.Redirect("~/Default.aspx",true);"?
[no name] 27-Oct-15 8:03am    
Can you please share your stack trace ?
Sergey Alexandrovich Kryukov 27-Oct-15 9:26am    
This is not "error". You need to understand what are exceptions. In this case, it tells you that the thread has been aborted. Learn about thread lifetime, blocking calls, wait state of thread, Thread.Abort, Thread.Interrupt, and so on...
—SA

Resolved

I found the error solution,
<![CDATA[<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs"
Inherits="project.SiteMaster" %>

in page attribute was like this AutoEventWireup="false"
and i changed this as AutoEventWireup="true"

problem resolved
 
Share this answer
 
v2
There is an odd quirk where if you redirect inside a try\catch you'll have this problem.

http://blogs.msdn.com/b/tmarq/archive/2009/06/25/correct-use-of-system-web-httpresponse-redirect.aspx[^]
 
Share this answer
 
It happens when you do Response.Redirect in the try catch. You can safely ignore this error.

You can read more here, https://support.microsoft.com/en-us/kb/312629[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900