Whats the easy way to debug asp.net

Hi,

How could I debuging on asp.net pages that not running of iis server directly.
a way to make alert LIKE window.alert("sometext");

Thanks
LVL 15
fsze88Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

quizwedgeCommented:
Typically what I use in this situation is either printing values of variables or "hey, I got here" messages to the screen or writing them to a file which I can manually check. Obviously, the second way is better in a production environment.
0
fsze88Author Commented:
how?
0
quizwedgeCommented:
I'm not sure if you're using VisualBasic.NET, C#.NET or some other .NET language, but here's a simple set of logging functions. I didn't originally write them and can't remember where I got them from, but fairly certain it had a pretty permissive license that would be fine in a commercial application. If someone comes across this and knows where it came from, let me know. I'll gladly give credit. It's been years since I found this code.

The code below is written in VisualBasic.NET. To add a line to the log, you would do the following.

FileAppend("C:\my_log_file.txt", "The value of the variable X is " & X & vbCrLf)

Open in new window


If X is 5, this will write the following to C:\my_log_file.txt: The value of variable X is 5. The vbCrLf at the end is so that the next FileAppend will put the text on the next line.

Code to make the logging work:

 Public Function FileExists(ByVal mPath As String) As Boolean
        Return System.IO.File.Exists(mPath)
    End Function

    Public Sub DeleteMe(ByVal source As String)
        System.IO.File.Delete(source)
    End Sub

    Public Sub FileAppend(ByVal mFile As String, ByVal mText As String)
        If Not FileExists(mFile) Then
            FileSave(mFile, mText)
            Exit Sub
        End If
        Dim fStream As System.IO.FileStream = New System.IO.FileStream(mFile, System.IO.FileMode.Append)
        Dim sWriter As System.IO.StreamWriter = New System.IO.StreamWriter(fStream)
        sWriter.BaseStream.Seek(0, System.IO.SeekOrigin.End)
        sWriter.Write(mText)
        sWriter.Flush()
        sWriter.Close()
        fStream.Close()
    End Sub

    Public Sub FileSave(ByVal mFile As String, ByVal mText As String)
        If FileExists(mFile) Then DeleteMe(mFile)
        Dim fStream As System.IO.FileStream = New System.IO.FileStream(mFile, System.IO.FileMode.OpenOrCreate)
        Dim sWriter As System.IO.StreamWriter = New System.IO.StreamWriter(fStream)
        sWriter.Write(mText)
        sWriter.Flush()
        sWriter.Close()
        fStream.Close()
    End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

fsze88Author Commented:
"hey, I got here" messages to the screen
0
fsze88Author Commented:
Sometimes is not works well by Response.Write()
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Frameworks

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.