Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. help...!!!

help...!!!

Scheduled Pinned Locked Moved ASP.NET
help
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jamal Abdul Nasir
    wrote on last edited by
    #1

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

            If 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

    S C S 3 Replies Last reply
    0
    • J Jamal Abdul Nasir

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

              If 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

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      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

      J 1 Reply Last reply
      0
      • S Sandeep Akhare

        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

        J Offline
        J Offline
        Jamal Abdul Nasir
        wrote on last edited by
        #3

        --> thnx 4 da answer sandeep... --> is there any other way to do it.. the best one...??

        J A Nasir K

        S 1 Reply Last reply
        0
        • J Jamal Abdul Nasir

          --> thnx 4 da answer sandeep... --> is there any other way to do it.. the best one...??

          J A Nasir K

          S Offline
          S Offline
          Sandeep Akhare
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • J Jamal Abdul Nasir

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

                    If 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

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            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 )

            1 Reply Last reply
            0
            • J Jamal Abdul Nasir

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

                      If 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

              S Offline
              S Offline
              saanj
              wrote on last edited by
              #6

              Hi, You can also use the window.location method to redirect.

              Either you love IT or leave IT...

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups