Tuesday, March 13, 2012

thread was being aborted

Hi, everyone

I create one application with form authentication.

When I try to run application and press login button it will redirect to default page and application run success fully, some time it will not redirect to default page .

For my application, I have to create one txt log file for error …

Sometime this error occurs when I press login button….

--------------------------

Source Code : mscorlib

Error Message : Thread was being aborted.

Stack Trace : at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpResponse.Redirect(String url, Boolean endResponse)

at System.Web.HttpResponse.Redirect(String url)

at pms._default.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\aspnet\pms\default.aspx.vb:line 104

--------------------------

source code for login button is……

--------------------------

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

Try

singleSqlString = "SELECT emp_code,password,access_level,emp_name " & _

"FROM login_master " & _

"WHERE emp_code='" & txtEmpCode.Text & "' AND password='" & txtPassword.Text & "' " & _

"ORDER BY emp_code ASC"

objlogin.FillDataSet(singleSqlString, "login_master")

If objlogin.dtSet.Tables("login_master").Rows.Count > 0 Then

Session("LoginCode") = txtEmpCode.Text

Session("EmpName") = objlogin.dtSet.Tables("login_master").Rows(0).Item("emp_name")

Session("AccessLevel") = objlogin.dtSet.Tables("login_master").Rows(0).Item("access_level")

FormsAuthentication.RedirectFromLoginPage(txtEmpCode.Text, False)

Else

lblmsg.Text = " Employee Code or Password may be wrong. - Try Again !!"

txtEmpCode.Text = ""

txtPassword.Text = ""

End If

Catch ex As ThreadAbortException

lblmsg.Visible = True

lblmsg.Text = "Thread is aboard"

Catch ex As Exception

objlogin.CreateLogFile(ex, objlogin.Message)

End Try

End Sub

--------------------------

when I trace my application using break point exception is not generated , but error occurs

plz give any solution and cause for this error.

Thanks in advance

Hi,

The error generated appears to be occuring on the default page:

at pms._default.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\aspnet\pms\default.aspx.vb:line 104

Have you checked/debugged the code here to see what's happening?

0 comments:

Post a Comment