help...!!!
-
--> em using dis code in on button click event...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim c As New blLogin
Try
c.UserName = Me.txtUserName.Text
c.Password = Me.txtPassword.TextIf c.Authenticate() Then Response.Redirect("Page2.aspx") Else Me.Label1.Text = "Invalid user name or password." End If Catch ex As Exception MsgBox(ex.Message) Finally c = Nothing End Try End Sub
--> but it gives me an error in catch block dat "Thread was being aborted". then, wen i press "OK" on da error message then da page is transfered to da "Page2.aspx".... wat does dis error mean... n how 2 remove dis... thnx...
J A Nasir K
-
--> em using dis code in on button click event...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim c As New blLogin
Try
c.UserName = Me.txtUserName.Text
c.Password = Me.txtPassword.TextIf c.Authenticate() Then Response.Redirect("Page2.aspx") Else Me.Label1.Text = "Invalid user name or password." End If Catch ex As Exception MsgBox(ex.Message) Finally c = Nothing End Try End Sub
--> but it gives me an error in catch block dat "Thread was being aborted". then, wen i press "OK" on da error message then da page is transfered to da "Page2.aspx".... wat does dis error mean... n how 2 remove dis... thnx...
J A Nasir K
Hi Abdul, Here is the issue Response.Redirect always throws Thread was being aborted exception as it needs to kill the current proccess, So ideally you should not have Response.Redirect("Page2.aspx") in the try catch block. use Response.Redirect("Page2.aspx",false) for more information http://support.microsoft.com/kb/312629/EN-US/[^] Make sure don't use Try catch uneccessarily it hits the performance by direclty catching the genereic exception. First check what exception you might get, if no exception expecting then don't put any try catch block
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog
-
Hi Abdul, Here is the issue Response.Redirect always throws Thread was being aborted exception as it needs to kill the current proccess, So ideally you should not have Response.Redirect("Page2.aspx") in the try catch block. use Response.Redirect("Page2.aspx",false) for more information http://support.microsoft.com/kb/312629/EN-US/[^] Make sure don't use Try catch uneccessarily it hits the performance by direclty catching the genereic exception. First check what exception you might get, if no exception expecting then don't put any try catch block
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog
--> thnx 4 da answer sandeep... --> is there any other way to do it.. the best one...??
J A Nasir K
-
--> thnx 4 da answer sandeep... --> is there any other way to do it.. the best one...??
J A Nasir K
For Best one you need to consider the Performance of the application Don't put try catch untill and unless you got any exception in the QA and provide the specific exception instead of generic. Please don't ask me it may help you in this implementation. Better buy a book on performace stuff or take google help so that it will help you while implementing any task.
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog
-
--> em using dis code in on button click event...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim c As New blLogin
Try
c.UserName = Me.txtUserName.Text
c.Password = Me.txtPassword.TextIf c.Authenticate() Then Response.Redirect("Page2.aspx") Else Me.Label1.Text = "Invalid user name or password." End If Catch ex As Exception MsgBox(ex.Message) Finally c = Nothing End Try End Sub
--> but it gives me an error in catch block dat "Thread was being aborted". then, wen i press "OK" on da error message then da page is transfered to da "Page2.aspx".... wat does dis error mean... n how 2 remove dis... thnx...
J A Nasir K
Jamal Abdul Nasir wrote:
em using dis code
Jamal Abdul Nasir wrote:
dat "Thread was being aborted
Jamal Abdul Nasir wrote:
wen i press "OK" on da error message then da page is transfered to da "Page2.aspx".... wat does dis error mean... n how 2 remove dis...
Wow - are you retarded ?
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
--> em using dis code in on button click event...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim c As New blLogin
Try
c.UserName = Me.txtUserName.Text
c.Password = Me.txtPassword.TextIf c.Authenticate() Then Response.Redirect("Page2.aspx") Else Me.Label1.Text = "Invalid user name or password." End If Catch ex As Exception MsgBox(ex.Message) Finally c = Nothing End Try End Sub
--> but it gives me an error in catch block dat "Thread was being aborted". then, wen i press "OK" on da error message then da page is transfered to da "Page2.aspx".... wat does dis error mean... n how 2 remove dis... thnx...
J A Nasir K