2012-09-20 2 views
0

오늘 나는이 질문에 debugger in vb.net skips line을 물었습니다. 그러나 나는 지금 일하고있는 프로젝트에 대해 이상한 (또는 어쩌면 그것은 vb.net에서 정상입니다) 것을 발견했습니다. 몇 가지 방법을 추가하여 VB 파일을 편집 중입니다. 원본 파일을 디버깅하는 데 문제가 없으므로 코드를 한 번에 한 줄씩 한 줄씩 아무 문제없이 이동할 수 있습니다. 나는 몇 가지 방법 디버거는이 두 스크린 샷을 확인, 정말 이상한 일 추가 이제 때vb.net 디버거가 디버깅을 위해 줄 건너 뛰기

  1. 의 웹 사이트가 시작되지 않습니다 -> 장소에서 모든 중단 점 : http://gyazo.com/1077b7efbdb2b37174d5960cdff0bda5.png?1348160907

  2. 웹 사이트가 시작 -> 2 차에서 중단 점 선이 누락되었습니다 http://gyazo.com/3051303d6eb27af9ea13bd6e72b81a83.png?1348161507

을 또한, 그때 때, 이제 디버깅, 라인으로 라인을 이동하지만, 1 라인에서 예를 들어, 단계를하지 않는 파일에 메소드를 추가 할 때 나는 f10을 클릭한다. 코드가 20 줄 더 아래로 간다. 코드의 다음 줄로 가지 않는다. 처음으로 vb.net 코드를 편집하고 있는데 C#을 독점적으로 사용하고 있었으며 디버거가 제대로 작동 할 수 있도록 파일을 편집 한 후에 무언가를 수정해야하는지 잘 모릅니다.

원래 코드 :

Public Class Login 
    Inherits System.Web.UI.Page 

    Private m_objFranchiseInfo As New clsFranchiseInfo 

    Private Sub Login_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init 
     Dim sEmail As String = Request.QueryString("email") 
     Dim sPswd As String = Request.QueryString("password") 



     If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then 

      If (sEmail.ToLower = "[email protected]") Then 
       FormsAuthentication.SetAuthCookie(sEmail, False) 
       Session("UserName") = sEmail 
       Session("Password") = sPswd 
      Else 

       Dim objService As New clsPropertyware 
       With objService 

        .UserName = sEmail 
        .Password = sPswd 
        .Initialize() 

        If .TestConnection = True Then 
         FormsAuthentication.SetAuthCookie(sEmail, False) 
         Session("UserName") = sEmail.ToLower 
         Session("Password") = sPswd 
         Session("OrgID") = .GetOrgID 


        Else 
         FormsAuthentication.SetAuthCookie("", True) 
         Session("UserName") = String.Empty 
         Session("Password") = String.Empty 
         Session("OrgID") = String.Empty 
        End If 

       End With 


      End If 
     Else 
      FormsAuthentication.SignOut() 
      Session("UserName") = String.Empty 
      Session("Password") = String.Empty 
      Session("OrgID") = String.Empty 
     End If 
    End Sub 



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 

     Dim sEmail As String = Request.QueryString("email") 
     Dim sPswd As String = Request.QueryString("password") 

     If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then 

      If (sEmail.ToLower = "[email protected]") Then 
       FormsAuthentication.SetAuthCookie(sEmail, False) 
       Session("UserName") = sEmail 
       Session("Password") = sPswd 
      Else 

       Dim objService As New clsPropertyware 
       With objService 

        .UserName = sEmail 
        .Password = sPswd 
        .Initialize() 

        If .TestConnection = True Then 
         FormsAuthentication.SetAuthCookie(sEmail, False) 
         Session("UserName") = sEmail.ToLower 
         Session("Password") = sPswd 
         Session("OrgID") = .GetOrgID 
         Response.Redirect("~/default.aspx") 
        Else 
         FormsAuthentication.SetAuthCookie("", True) 
         Session("UserName") = String.Empty 
         Session("Password") = String.Empty 
         Session("OrgID") = String.Empty 
        End If 

       End With 


      End If 
     Else 
      FormsAuthentication.SignOut() 
      Session("UserName") = String.Empty 
      Session("Password") = String.Empty 
      Session("OrgID") = String.Empty 
     End If 
    End Sub 



    Private Sub LoginUser_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles LoginUser.Authenticate 

     Dim szUserName As String = CType(LoginUser.FindControl("UserName"), TextBox).Text().Trim() 
     Dim szPassword As String = CType(LoginUser.FindControl("Password"), TextBox).Text().Trim() 

     If (szUserName.ToLower = "[email protected]") Then 
      e.Authenticated = True 
      Session("UserName") = szUserName 
      Session("Password") = szPassword 
     Else 

      Dim objService As New clsPropertyware 
      With objService 

       .UserName = szUserName 
       .Password = szPassword 
       .Initialize() 

       If .TestConnection = True Then 
        e.Authenticated = True 
        Session("UserName") = szUserName.ToLower 
        Session("Password") = szPassword 
        Session("OrgID") = .GetOrgID 
       Else 
        e.Authenticated = False 
        Session("UserName") = String.Empty 
        Session("Password") = String.Empty 
        Session("OrgID") = String.Empty 
       End If 

      End With 
     End If 

    End Sub 


    Private Sub LoginUser_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginUser.LoggedIn 

     If (Session("UserName") = "[email protected]") Then 
      Response.Redirect("~/UploadValues.aspx") 
     Else 

      m_objFranchiseInfo.Clear() 
      If (m_objFranchiseInfo.Load(Session("UserName")) = True) Then 
       Session("FranchiseAgent") = m_objFranchiseInfo.szAgent 
       Session("FranchiseAgent2") = m_objFranchiseInfo.szAgent2 
       Session("FranchiseAddress") = m_objFranchiseInfo.szAddress 
       Session("FranchiseCity") = m_objFranchiseInfo.szCity 
       Session("FranchiseState") = m_objFranchiseInfo.szState 
       Session("FranchiseZip") = m_objFranchiseInfo.szZip 
       Session("FranchisePhone") = m_objFranchiseInfo.szPhone 
       Session("FranchiseFax") = m_objFranchiseInfo.szFax 
       Session("FranchiseEmail") = m_objFranchiseInfo.szEmail 
      Else 
       Response.Redirect("~\FranchiseInfo.aspx") 
      End If 
     End If 

    End Sub 
End Class 

수정 된 코드는 :

Imports System.Security.Cryptography 

Public Class Login 
    Inherits System.Web.UI.Page 

    Private m_objFranchiseInfo As New clsFranchiseInfo 

    Private Sub Login_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init 
     Dim sEmail As String = Request.QueryString("email") 
     Dim sPswd As String = Request.QueryString("password") 



     If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then 

      If (sEmail.ToLower = "[email protected]") Then 
       FormsAuthentication.SetAuthCookie(sEmail, False) 
       Session("UserName") = sEmail 
       Session("Password") = sPswd 
      Else 

       Dim objService As New clsPropertyware 
       With objService 

        .UserName = sEmail 
        .Password = sPswd 
        .Initialize() 

        If .TestConnection = True Then 
         FormsAuthentication.SetAuthCookie(sEmail, False) 
         Session("UserName") = sEmail.ToLower 
         Session("Password") = sPswd 
         Session("OrgID") = .GetOrgID 


        Else 
         FormsAuthentication.SetAuthCookie("", True) 
         Session("UserName") = String.Empty 
         Session("Password") = String.Empty 
         Session("OrgID") = String.Empty 
        End If 

       End With 


      End If 
     Else 
      FormsAuthentication.SignOut() 
      Session("UserName") = String.Empty 
      Session("Password") = String.Empty 
      Session("OrgID") = String.Empty 
     End If 
    End Sub 



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 

     Dim encryptedEmail As String = "[email protected]" 
     Dim decryptEmail As String = DecryptData("[email protected]") 
     Dim encrpytedPassword As String = "password" 




     Dim sEmail As String = Request.QueryString("email") 
     Dim sPswd As String = Request.QueryString("password") 

     If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then 

      If (sEmail.ToLower = "[email protected]") Then 
       FormsAuthentication.SetAuthCookie(sEmail, False) 
       Session("UserName") = sEmail 
       Session("Password") = sPswd 
      Else 

       Dim objService As New clsPropertyware 
       With objService 

        .UserName = sEmail 
        .Password = sPswd 
        .Initialize() 

        If .TestConnection = True Then 
         FormsAuthentication.SetAuthCookie(sEmail, False) 
         Session("UserName") = sEmail.ToLower 
         Session("Password") = sPswd 
         Session("OrgID") = .GetOrgID 
         Response.Redirect("~/default.aspx") 
        Else 
         FormsAuthentication.SetAuthCookie("", True) 
         Session("UserName") = String.Empty 
         Session("Password") = String.Empty 
         Session("OrgID") = String.Empty 
        End If 

       End With 


      End If 
     Else 
      FormsAuthentication.SignOut() 
      Session("UserName") = String.Empty 
      Session("Password") = String.Empty 
      Session("OrgID") = String.Empty 
     End If 
    End Sub 



    Private Sub LoginUser_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles LoginUser.Authenticate 

     Dim szUserName As String = CType(LoginUser.FindControl("UserName"), TextBox).Text().Trim() 
     Dim szPassword As String = CType(LoginUser.FindControl("Password"), TextBox).Text().Trim() 

     If (szUserName.ToLower = "[email protected]") Then 
      e.Authenticated = True 
      Session("UserName") = szUserName 
      Session("Password") = szPassword 
     Else 

      Dim objService As New clsPropertyware 
      With objService 

       .UserName = szUserName 
       .Password = szPassword 
       .Initialize() 

       If .TestConnection = True Then 
        e.Authenticated = True 
        Session("UserName") = szUserName.ToLower 
        Session("Password") = szPassword 
        Session("OrgID") = .GetOrgID 
       Else 
        e.Authenticated = False 
        Session("UserName") = String.Empty 
        Session("Password") = String.Empty 
        Session("OrgID") = String.Empty 
       End If 

      End With 
     End If 

    End Sub 


    Private Sub LoginUser_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginUser.LoggedIn 

     If (Session("UserName") = "[email protected]") Then 
      Response.Redirect("~/UploadValues.aspx") 
     Else 

      m_objFranchiseInfo.Clear() 
      If (m_objFranchiseInfo.Load(Session("UserName")) = True) Then 
       Session("FranchiseAgent") = m_objFranchiseInfo.szAgent 
       Session("FranchiseAgent2") = m_objFranchiseInfo.szAgent2 
       Session("FranchiseAddress") = m_objFranchiseInfo.szAddress 
       Session("FranchiseCity") = m_objFranchiseInfo.szCity 
       Session("FranchiseState") = m_objFranchiseInfo.szState 
       Session("FranchiseZip") = m_objFranchiseInfo.szZip 
       Session("FranchisePhone") = m_objFranchiseInfo.szPhone 
       Session("FranchiseFax") = m_objFranchiseInfo.szFax 
       Session("FranchiseEmail") = m_objFranchiseInfo.szEmail 
      Else 
       Response.Redirect("~\FranchiseInfo.aspx") 
      End If 
     End If 

    End Sub 

    Public Function DecryptData(
    ByVal encryptedtext As String) As String 

     ' Convert the encrypted text string to a byte array. 
     Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext) 

     ' Create the stream. 
     Dim ms As New System.IO.MemoryStream 
     ' Create the decoder to write to the stream. 
     Dim decStream As New CryptoStream(ms, 
      TripleDES.CreateDecryptor(), 
      System.Security.Cryptography.CryptoStreamMode.Write) 

     ' Use the crypto stream to write the byte array to the stream. 
     decStream.Write(encryptedBytes, 0, encryptedBytes.Length) 
     decStream.FlushFinalBlock() 

     ' Convert the plaintext stream to a string. 
     Return System.Text.Encoding.Unicode.GetString(ms.ToArray) 
    End Function 

    Private Function TruncateHash(
    ByVal key As String, 
    ByVal length As Integer) As Byte() 

     Dim sha1 As New SHA1CryptoServiceProvider 

     ' Hash the key. 
     Dim keyBytes() As Byte = 
      System.Text.Encoding.Unicode.GetBytes(key) 
     Dim hash() As Byte = sha1.ComputeHash(keyBytes) 

     ' Truncate or pad the hash. 
     ReDim Preserve hash(length - 1) 
     Return hash 
    End Function 

    Sub New(ByVal key As String) 
     ' Initialize the crypto provider. 
     TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8) 
     TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8) 
    End Sub 

    Public Function EncryptData(
    ByVal plaintext As String) As String 

     ' Convert the plaintext string to a byte array. 
     Dim plaintextBytes() As Byte = 
      System.Text.Encoding.Unicode.GetBytes(plaintext) 

     ' Create the stream. 
     Dim ms As New System.IO.MemoryStream 
     ' Create the encoder to write to the stream. 
     Dim encStream As New CryptoStream(ms, 
      TripleDes.CreateEncryptor(), 
      System.Security.Cryptography.CryptoStreamMode.Write) 

     ' Use the crypto stream to write the byte array to the stream. 
     encStream.Write(plaintextBytes, 0, plaintextBytes.Length) 
     encStream.FlushFinalBlock() 

     ' Convert the encrypted stream to a printable string. 
     Return Convert.ToBase64String(ms.ToArray) 
    End Function 

End Class 

모든 도움을 환영합니다. 미리 감사드립니다.

+0

빌드 구성이'Debug' 또는'Release'입니까? –

+0

빌드 구성이 디버그로 설정되었습니다. – Laziale

+0

중복 http://stackoverflow.com/questions/3144880/visual-studio-2010-debugger-skipping – Michael

답변

1

ASP.net 개발 서버를 사용하여 호스팅하는 경우 Visual Studio가 중지 되어도 해당 프로세스가 여전히 코드를 실행하고있을 때 이러한 현상이 발생합니다. 새 디버깅 세션을 시작하면 두 세션을 모두 따르려고합니다. 브라우저 창을 닫지 않고 멈춤 버튼을 누르고 긴 실행 또는 비동기 프로세스가있을 때 이것이 발생할 수 있다고 생각합니다.

작업 표시 줄의 ASP.net 개발 서버 아이콘을 마우스 오른쪽 단추로 클릭하고 중지를 선택한 다음 디버깅을 시작하십시오.