Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web error's 1

Status
Not open for further replies.

Junior1544

Technical User
Apr 20, 2001
1,267
US
I'm developing on a remote server... How do I get asp.net to give me a full description of web page error's... Right now it just tells me that it can't do that for security reasons... And I don't have direct access to the web server on a constant basis... once every few days maybe...

Thanks for your help...

--James


junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Hmm - this was interesting
Obviously from reading the page which comes up with the security message, you can change the web.config so that you can see error messages on remote machines, and you can also redirect the normal user to a more friendly page - this page explains how to do that as well.

The problem with this approach is that if you set the web.config to show error messges to remote machines, all remote machines will see the messages. So we have to be a bit cleverer.

In global.asax, you get the Application_OnError sub. You can use this to refine the process a bit.
Code:
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when an error occurs
        Dim strIP As String = Request.ServerVariables("Remote_Addr")
        If strIP <> &quot;MyRemoteMachinesIPAddress&quot; AndAlso strIP <> &quot;127.0.0.1&quot; Then
            Response.Redirect(&quot;MyApologyPage.aspx&quot;, True)
        End If
    End Sub

I'm then suggesting that you leave the entry in web.config as follows

Code:
    <customErrors mode=&quot;Off&quot; />

This then allows you to see the error messages on a specific remote machine

Hope this solves your problem.

Mark [openup]
 
I've tried to understand what was on the error page to get it to come up, But couldn't get my brain around it... This solution I will be looking at this afternoon because it looks like better then I could have come up with...

Great!

Here's a star even befor I get to work with it:)

--James


junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top