By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Web.Config - customErrors

P: n/a
I am trying to implement custom error pages and I get this error message:

************************************************** **************************
********
************************************************** **************************
********
Server Error in '/mfg' Application.
----------------------------------------------------------------------------
----

Runtime Error
Description: An application error occurred on the server. The current custom
error settings for this application prevent the details of the application
error from being viewed.

Details: To enable the details of this specific error message to be viewable
on the local server machine, please create a <customErrors> tag within a
"web.config" configuration file located in the root directory of the current
web application. This <customErrors> tag should then have its "mode"
attribute set to "RemoteOnly". To enable the details to be viewable on
remote machines, please set "mode" to "Off".
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom
error page by modifying the "defaultRedirect" attribute of the application's
<customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
************************************************** **************************
********
************************************************** **************************
********

My my customErrors tag in the Web.Config file looks like this:

<customErrors defaultRedirect="errors.aspx" mode="On"/>

I am working directly on the server (Win2k). Any ideas?

Thanx.

Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
If you change your customErrors to Off with no defaultRedirect, do you still
get an error?

If not, try switching the order of the defaultRedirect and mode attributes.
Its a long shot but it might work. Let me know how it works out.
"John Smith" <no*******@address.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
I am trying to implement custom error pages and I get this error message:

************************************************** ************************** ********
************************************************** ************************** ********
Server Error in '/mfg' Application.
-------------------------------------------------------------------------- -- ----

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application
error from being viewed.

Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a
"web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode"
attribute set to "RemoteOnly". To enable the details to be viewable on
remote machines, please set "mode" to "Off".
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom
error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
************************************************** ************************** ********
************************************************** ************************** ********

My my customErrors tag in the Web.Config file looks like this:

<customErrors defaultRedirect="errors.aspx" mode="On"/>

I am working directly on the server (Win2k). Any ideas?

Thanx.

Nov 18 '05 #2

P: n/a
I made a change to my customErrors tag to:

<customErrors defaultRedirect="errors.aspx" mode="RemoteOnly"/>

I tested with just an HTML file and it worked okay. I eliminated the the
web.config as the problem it is now within my code. I found out that I am
actually having a problem with this code:

************************************************** **************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'*** UserID Works fine ***
Dim UserID As Integer = Session("UserID")
Response.Write("UserID = " & UserID & "<BR>")

'*** Problem resides in here ***
Dim ErrorMessage As String = Server.GetLastError.ToString
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")

End Sub
************************************************** **************************

Any ideas on what I am doing wrong?

Thanx
"Ben Dewey" <be*******@scientiae.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
If you change your customErrors to Off with no defaultRedirect, do you still get an error?

If not, try switching the order of the defaultRedirect and mode attributes. Its a long shot but it might work. Let me know how it works out.
"John Smith" <no*******@address.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
I am trying to implement custom error pages and I get this error message:

************************************************** **************************
********

************************************************** **************************
********
Server Error in '/mfg' Application.


--------------------------------------------------------------------------
--
----

Runtime Error
Description: An application error occurred on the server. The current

custom
error settings for this application prevent the details of the application error from being viewed.

Details: To enable the details of this specific error message to be

viewable
on the local server machine, please create a <customErrors> tag within a
"web.config" configuration file located in the root directory of the

current
web application. This <customErrors> tag should then have its "mode"
attribute set to "RemoteOnly". To enable the details to be viewable on
remote machines, please set "mode" to "Off".
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom
error page by modifying the "defaultRedirect" attribute of the

application's
<customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

************************************************** **************************
********

************************************************** **************************
********

My my customErrors tag in the Web.Config file looks like this:

<customErrors defaultRedirect="errors.aspx" mode="On"/>

I am working directly on the server (Win2k). Any ideas?

Thanx.


Nov 18 '05 #3

P: n/a
You need to check the Server.GetLastError before you call ToString on it.

Example:
If Server.GetLastError Is Nothing = False Then
Dim ErrorMessage As String = Server.GetLastError.ToString()
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")
End If
"John Smith" <no*******@address.com> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
I made a change to my customErrors tag to:

<customErrors defaultRedirect="errors.aspx" mode="RemoteOnly"/>

I tested with just an HTML file and it worked okay. I eliminated the the
web.config as the problem it is now within my code. I found out that I am
actually having a problem with this code:

************************************************** ************************** Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'*** UserID Works fine ***
Dim UserID As Integer = Session("UserID")
Response.Write("UserID = " & UserID & "<BR>")

'*** Problem resides in here ***
Dim ErrorMessage As String = Server.GetLastError.ToString
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")

End Sub
************************************************** **************************
Any ideas on what I am doing wrong?

Thanx
"Ben Dewey" <be*******@scientiae.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
If you change your customErrors to Off with no defaultRedirect, do you

still
get an error?

If not, try switching the order of the defaultRedirect and mode

attributes.
Its a long shot but it might work. Let me know how it works out.
"John Smith" <no*******@address.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
I am trying to implement custom error pages and I get this error message:

************************************************** **************************
********

************************************************** **************************
********
Server Error in '/mfg' Application.


--------------------------------------------------------------------------
--
----

Runtime Error
Description: An application error occurred on the server. The current

custom
error settings for this application prevent the details of the application error from being viewed.

Details: To enable the details of this specific error message to be

viewable
on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the

current
web application. This <customErrors> tag should then have its "mode"
attribute set to "RemoteOnly". To enable the details to be viewable on
remote machines, please set "mode" to "Off".
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the

application's
<customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

************************************************** **************************
********

************************************************** **************************
********

My my customErrors tag in the Web.Config file looks like this:

<customErrors defaultRedirect="errors.aspx" mode="On"/>

I am working directly on the server (Win2k). Any ideas?

Thanx.



Nov 18 '05 #4

P: n/a
I changed my code to check to see if it is nothing. I manually threw an
applicationexception and it is not returning it. it is returning as
nothing. any ideas?
"Ben Dewey" <be*******@scientiae.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You need to check the Server.GetLastError before you call ToString on it.

Example:
If Server.GetLastError Is Nothing = False Then
Dim ErrorMessage As String = Server.GetLastError.ToString()
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")
End If
"John Smith" <no*******@address.com> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
I made a change to my customErrors tag to:

<customErrors defaultRedirect="errors.aspx" mode="RemoteOnly"/>

I tested with just an HTML file and it worked okay. I eliminated the the
web.config as the problem it is now within my code. I found out that I am actually having a problem with this code:

************************************************** **************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'*** UserID Works fine ***
Dim UserID As Integer = Session("UserID")
Response.Write("UserID = " & UserID & "<BR>")

'*** Problem resides in here ***
Dim ErrorMessage As String = Server.GetLastError.ToString
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")

End Sub

************************************************** **************************

Any ideas on what I am doing wrong?

Thanx
"Ben Dewey" <be*******@scientiae.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
If you change your customErrors to Off with no defaultRedirect, do you

still
get an error?

If not, try switching the order of the defaultRedirect and mode

attributes.
Its a long shot but it might work. Let me know how it works out.
"John Smith" <no*******@address.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
> I am trying to implement custom error pages and I get this error

message:
>
>

************************************************** **************************
> ********
>

************************************************** **************************
> ********
> Server Error in '/mfg' Application.


--------------------------------------------------------------------------
--
> ----
>
> Runtime Error
> Description: An application error occurred on the server. The current custom
> error settings for this application prevent the details of the

application
> error from being viewed.
>
> Details: To enable the details of this specific error message to be
viewable
> on the local server machine, please create a <customErrors> tag within a
> "web.config" configuration file located in the root directory of the
current
> web application. This <customErrors> tag should then have its "mode"
> attribute set to "RemoteOnly". To enable the details to be viewable
on > remote machines, please set "mode" to "Off".
>
>
> <!-- Web.Config Configuration File -->
>
> <configuration>
> <system.web>
> <customErrors mode="RemoteOnly"/>
> </system.web>
> </configuration>
>
>
> Notes: The current error page you are seeing can be replaced by a

custom > error page by modifying the "defaultRedirect" attribute of the
application's
> <customErrors> configuration tag to point to a custom error page URL. >
>
> <!-- Web.Config Configuration File -->
>
> <configuration>
> <system.web>
> <customErrors mode="On" defaultRedirect="mycustompage.htm"/>
> </system.web>
> </configuration>
>

************************************************** **************************
> ********
>

************************************************** **************************
> ********
>
> My my customErrors tag in the Web.Config file looks like this:
>
> <customErrors defaultRedirect="errors.aspx" mode="On"/>
>
> I am working directly on the server (Win2k). Any ideas?
>
> Thanx.
>
>
>



Nov 18 '05 #5

P: n/a
My mistake, you don't need to check if the error is nothing, you do, on the
other hand, need to have the code for the Page Error in the Page_Error event
handler.

Example:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call throwAnError()
End Sub

Private Sub throwAnError()
Throw New ApplicationException("some error")
End Sub

Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Error
Dim ErrorMessage As String = Server.GetLastError.Message
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")
End Sub
"John Smith" <no*******@address.com> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl...
I changed my code to check to see if it is nothing. I manually threw an
applicationexception and it is not returning it. it is returning as
nothing. any ideas?
"Ben Dewey" <be*******@scientiae.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You need to check the Server.GetLastError before you call ToString on it.

Example:
If Server.GetLastError Is Nothing = False Then
Dim ErrorMessage As String = Server.GetLastError.ToString()
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")
End If
"John Smith" <no*******@address.com> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
I made a change to my customErrors tag to:

<customErrors defaultRedirect="errors.aspx" mode="RemoteOnly"/>

I tested with just an HTML file and it worked okay. I eliminated the
the web.config as the problem it is now within my code. I found out that I am
actually having a problem with this code:

************************************************** ************************** Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'*** UserID Works fine ***
Dim UserID As Integer = Session("UserID")
Response.Write("UserID = " & UserID & "<BR>")

'*** Problem resides in here ***
Dim ErrorMessage As String = Server.GetLastError.ToString
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")

End Sub

************************************************** **************************

Any ideas on what I am doing wrong?

Thanx
"Ben Dewey" <be*******@scientiae.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> If you change your customErrors to Off with no defaultRedirect, do you still
> get an error?
>
> If not, try switching the order of the defaultRedirect and mode
attributes.
> Its a long shot but it might work. Let me know how it works out.
>
>
> "John Smith" <no*******@address.com> wrote in message
> news:O$**************@TK2MSFTNGP10.phx.gbl...
> > I am trying to implement custom error pages and I get this error
message:
> >
> >
>

************************************************** **************************
> > ********
> >
>

************************************************** **************************
> > ********
> > Server Error in '/mfg' Application.
>


--------------------------------------------------------------------------
> --
> > ----
> >
> > Runtime Error
> > Description: An application error occurred on the server. The current > custom
> > error settings for this application prevent the details of the
application
> > error from being viewed.
> >
> > Details: To enable the details of this specific error message to be > viewable
> > on the local server machine, please create a <customErrors> tag within
a
> > "web.config" configuration file located in the root directory of the > current
> > web application. This <customErrors> tag should then have its "mode" > > attribute set to "RemoteOnly". To enable the details to be viewable on > > remote machines, please set "mode" to "Off".
> >
> >
> > <!-- Web.Config Configuration File -->
> >
> > <configuration>
> > <system.web>
> > <customErrors mode="RemoteOnly"/>
> > </system.web>
> > </configuration>
> >
> >
> > Notes: The current error page you are seeing can be replaced by a

custom
> > error page by modifying the "defaultRedirect" attribute of the
> application's
> > <customErrors> configuration tag to point to a custom error page URL. > >
> >
> > <!-- Web.Config Configuration File -->
> >
> > <configuration>
> > <system.web>
> > <customErrors mode="On"
defaultRedirect="mycustompage.htm"/> > > </system.web>
> > </configuration>
> >
>

************************************************** **************************
> > ********
> >
>

************************************************** **************************
> > ********
> >
> > My my customErrors tag in the Web.Config file looks like this:
> >
> > <customErrors defaultRedirect="errors.aspx" mode="On"/>
> >
> > I am working directly on the server (Win2k). Any ideas?
> >
> > Thanx.
> >
> >
> >
>
>



Nov 18 '05 #6

P: n/a
Thanx that works good, but I found another solution. I added
Server.Transfer("customerror.aspx") in the Application_Error in the
global.asax file.

Thanx for all of your help.

"Ben Dewey" <be*******@scientiae.com> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
My mistake, you don't need to check if the error is nothing, you do, on the other hand, need to have the code for the Page Error in the Page_Error event handler.

Example:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call throwAnError()
End Sub

Private Sub throwAnError()
Throw New ApplicationException("some error")
End Sub

Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Error
Dim ErrorMessage As String = Server.GetLastError.Message
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")
End Sub
"John Smith" <no*******@address.com> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl...
I changed my code to check to see if it is nothing. I manually threw an
applicationexception and it is not returning it. it is returning as
nothing. any ideas?
"Ben Dewey" <be*******@scientiae.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You need to check the Server.GetLastError before you call ToString on it.
Example:
If Server.GetLastError Is Nothing = False Then
Dim ErrorMessage As String = Server.GetLastError.ToString()
Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")
End If
"John Smith" <no*******@address.com> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
> I made a change to my customErrors tag to:
>
> <customErrors defaultRedirect="errors.aspx" mode="RemoteOnly"/>
>
> I tested with just an HTML file and it worked okay. I eliminated the
the
> web.config as the problem it is now within my code. I found out
that
I
am
> actually having a problem with this code:
>
>

************************************************** ************************** > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> '*** UserID Works fine ***
> Dim UserID As Integer = Session("UserID")
> Response.Write("UserID = " & UserID & "<BR>")
>
> '*** Problem resides in here ***
> Dim ErrorMessage As String = Server.GetLastError.ToString
> Response.Write("ErrorMessage = " & ErrorMessage & "<BR>")
>
> End Sub
>

************************************************** **************************
>
> Any ideas on what I am doing wrong?
>
> Thanx
>
>
> "Ben Dewey" <be*******@scientiae.com> wrote in message
> news:%2****************@TK2MSFTNGP10.phx.gbl...
> > If you change your customErrors to Off with no defaultRedirect, do you > still
> > get an error?
> >
> > If not, try switching the order of the defaultRedirect and mode
> attributes.
> > Its a long shot but it might work. Let me know how it works out.
> >
> >
> > "John Smith" <no*******@address.com> wrote in message
> > news:O$**************@TK2MSFTNGP10.phx.gbl...
> > > I am trying to implement custom error pages and I get this error
> message:
> > >
> > >
> >
>

************************************************** **************************
> > > ********
> > >
> >
>

************************************************** **************************
> > > ********
> > > Server Error in '/mfg' Application.
> >
>


--------------------------------------------------------------------------
> > --
> > > ----
> > >
> > > Runtime Error
> > > Description: An application error occurred on the server. The

current
> > custom
> > > error settings for this application prevent the details of the
> application
> > > error from being viewed.
> > >
> > > Details: To enable the details of this specific error message to be > > viewable
> > > on the local server machine, please create a <customErrors> tag

within
a
> > > "web.config" configuration file located in the root directory of the > > current
> > > web application. This <customErrors> tag should then have its "mode" > > > attribute set to "RemoteOnly". To enable the details to be viewable
on
> > > remote machines, please set "mode" to "Off".
> > >
> > >
> > > <!-- Web.Config Configuration File -->
> > >
> > > <configuration>
> > > <system.web>
> > > <customErrors mode="RemoteOnly"/>
> > > </system.web>
> > > </configuration>
> > >
> > >
> > > Notes: The current error page you are seeing can be replaced by a custom
> > > error page by modifying the "defaultRedirect" attribute of the
> > application's
> > > <customErrors> configuration tag to point to a custom error page

URL.
> > >
> > >
> > > <!-- Web.Config Configuration File -->
> > >
> > > <configuration>
> > > <system.web>
> > > <customErrors mode="On"

defaultRedirect="mycustompage.htm"/> > > > </system.web>
> > > </configuration>
> > >
> >
>

************************************************** **************************
> > > ********
> > >
> >
>

************************************************** **************************
> > > ********
> > >
> > > My my customErrors tag in the Web.Config file looks like this:
> > >
> > > <customErrors defaultRedirect="errors.aspx" mode="On"/>
> > >
> > > I am working directly on the server (Win2k). Any ideas?
> > >
> > > Thanx.
> > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.