473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Custom Error not working

the customError feature is not working. I have it setup as the help says in
my web.config file.

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

I tried in a couple different parts of my site to throw a dummy exception
and I always get to the page that says change my web.config to the statement
above.
Nov 18 '05 #1
9 13873
try this:

<customErrors mode="Off" defaultRedirect="DsAppError.aspx"/>

m.

--------------
"Nick" <ni**@digitronics.com> wrote in message
news:Pj****************@newsread2.news.pas.earthli nk.net...
the customError feature is not working. I have it setup as the help says in my web.config file.

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

I tried in a couple different parts of my site to throw a dummy exception
and I always get to the page that says change my web.config to the statement above.

Nov 18 '05 #2
Is the documentation on this feature wrong? If customError is off then
according to the documentation you get a page generated with the error and
stack trace and no custom error pages will be shown.

What I want is for it to work like it says for remoteOnly. I want error and
stack trace info on the development or "local" system and that works fine.
On RemoteOnly I get a generated page with exception information. But on
RemoteOnly on any other machine I get a message saying you can replace this
page with a custom message. Well I have defined that but I do not know why
it doesnt work. If I turn the setting to Off like you suggested then remote
users get error and stack trace information which is not what I want.

"Mohammad Samara" <mo******@samara.fslife.co.uk> wrote in message
news:uq**************@TK2MSFTNGP12.phx.gbl...
try this:

<customErrors mode="Off" defaultRedirect="DsAppError.aspx"/>

m.

--------------
"Nick" <ni**@digitronics.com> wrote in message
news:Pj****************@newsread2.news.pas.earthli nk.net...
the customError feature is not working. I have it setup as the help says
in
my web.config file.

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

I tried in a couple different parts of my site to throw a dummy

exception and I always get to the page that says change my web.config to the

statement
above.


Nov 18 '05 #3
Hi Nick,
Thank you for using Microsoft Newsgroup service. From your description,
you're wanting to set a custom error page in an ASP.NET web application
which will be shown for the remote client user when error occurs. And you
set the "customErrors" element as :
<customErrors defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>
in the web.config file. However, you found this didn't work. Is my
understanding correct? If anything wrong, please feel free to correct me.

Firstly, I'm sure your original setting as "<customErrors
defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>" is quite correct. So
I do feel abit strange as it doesn't work. Would you please try out the
following tests:

1. change the "mode=" as "On" and see whether it display the custom error
page("DsAppError.aspx") both on local or remote client?

2. If still fails to work, I think you may have a check on the error
page("DsAppError.aspx"), is it accessable or if there is something
incorrect with the error page? For example, you can try setting the
defaultRedirect page as
defaultRedirect="http://localhost/appname/DsAppError.aspx" to specify the
full path.

3. If still with no success after the above steps, would you try creating
another simple web application and provide a simple error page and set the
web.config as
"<customErrors defaultRedirect="customerrorpagename" mode="RemoteOnly"/>"

Also, you may try rebooting the IIS server. Or check the server enviroment.
Please try out the preceding suggestion. If you have any quesions or need
any help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4
mode = On

local = My custom page shown but Server.GetLastError() returned null
remote = My custom page shown but Server.GetLastError() returned null

mode = RemoteOnly

local = Generated page shown with message and stack trace
remote = My custom page shown but Server.GetLastError() returned null

mode = Off

local = Generated page shown with message and stack trace
remote = Generated page shown with message and stack trace

Well, I changed a few things and all of a sudden it starts working, well
sort of. Looks like after setting it on and then to RemoteOnly it started
working.

I must be misunderstanding the help on Server.GetLastError().... Why is it
returning null in my DsAppError.aspx code?
Nov 18 '05 #5
I spoke to soon, it has stopped working again. I decided I wanted to show
error information my own way even on the local machine, so I set the
mode="On".

As soon as I did that and I ran the my test page, I was sent to a generated
page telling me to change my web.config file. This is making me crazy.

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:8Z**************@cpmsftngxa07.phx.gbl...
Hi Nick,
Thank you for using Microsoft Newsgroup service. From your description,
you're wanting to set a custom error page in an ASP.NET web application
which will be shown for the remote client user when error occurs. And you
set the "customErrors" element as :
<customErrors defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>
in the web.config file. However, you found this didn't work. Is my
understanding correct? If anything wrong, please feel free to correct me.

Firstly, I'm sure your original setting as "<customErrors
defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>" is quite correct. So I do feel abit strange as it doesn't work. Would you please try out the
following tests:

1. change the "mode=" as "On" and see whether it display the custom error
page("DsAppError.aspx") both on local or remote client?

2. If still fails to work, I think you may have a check on the error
page("DsAppError.aspx"), is it accessable or if there is something
incorrect with the error page? For example, you can try setting the
defaultRedirect page as
defaultRedirect="http://localhost/appname/DsAppError.aspx" to specify the
full path.

3. If still with no success after the above steps, would you try creating
another simple web application and provide a simple error page and set the
web.config as
"<customErrors defaultRedirect="customerrorpagename" mode="RemoteOnly"/>"

Also, you may try rebooting the IIS server. Or check the server enviroment. Please try out the preceding suggestion. If you have any quesions or need
any help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6
I think I have figured this out. I am using forms authentication which is
the problem.

The first test I made was on the 2nd page after the login page so the user
had logged in, went to my test page and got the test error. At this point
they were redirected to the error page but no matter what
server.GetLastError() returned null, not sure why.

I moved the test error to the login page. So when the login page comes up,
the error takes place and is redirected to the DsAppError.aspx but they have
not been authenticated so they are sent back to the Login.aspx but that is
where the error is. I am assuming that something is detecting the circular
page reference and stopping it and telling the user (me) to change the
web.config. But the real problem is the circular page reference.

I am not sure what authentication is the best way. I am taking users to the
login page to ask for user name and password and I am then going to check
that information against a table in SQL Server. It will not be the login to
sql server as that will be a fixed value but will be checked against a data
table.

Is there a better mode basic authentication for this setup than Forms
authentication or can I simply make the DsAppError.aspx a form that does not
recquire authentication?

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:8Z**************@cpmsftngxa07.phx.gbl...
Hi Nick,
Thank you for using Microsoft Newsgroup service. From your description,
you're wanting to set a custom error page in an ASP.NET web application
which will be shown for the remote client user when error occurs. And you
set the "customErrors" element as :
<customErrors defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>
in the web.config file. However, you found this didn't work. Is my
understanding correct? If anything wrong, please feel free to correct me.

Firstly, I'm sure your original setting as "<customErrors
defaultRedirect="DsAppError.aspx" mode="RemoteOnly"/>" is quite correct. So I do feel abit strange as it doesn't work. Would you please try out the
following tests:

1. change the "mode=" as "On" and see whether it display the custom error
page("DsAppError.aspx") both on local or remote client?

2. If still fails to work, I think you may have a check on the error
page("DsAppError.aspx"), is it accessable or if there is something
incorrect with the error page? For example, you can try setting the
defaultRedirect page as
defaultRedirect="http://localhost/appname/DsAppError.aspx" to specify the
full path.

3. If still with no success after the above steps, would you try creating
another simple web application and provide a simple error page and set the
web.config as
"<customErrors defaultRedirect="customerrorpagename" mode="RemoteOnly"/>"

Also, you may try rebooting the IIS server. Or check the server enviroment. Please try out the preceding suggestion. If you have any quesions or need
any help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #7
Hi Nick,

Thanks for your response. I'm glad you've figured out the actual problem.
As for the Authenticaion Mode and the "circular page reference" problem you
mentioned. Here is my suggestion:

I think the Form Authentication is a very convenient and flexible means of
authentication since it provide a simple implementation and custom account
checking(via custom database or other user list). The problem cause the
circular page is that the custom error page is authentication protected so
that unauthenticated user we be redirect to login page. I've also used the
FormAuthentication before , and use a common custom error page. My solution
is to set all those common pages such as "register page" , "about page" or
"custom error page", "custom success info page" 's permission as
<alow user="*"> , only set strict permission for certain part of
pages(which may have important infos)
Thus, the unauthenticated users(anonymous) can also visit those those
common page.
How do you think of this?

In addition, as for the other authentication mode you mentioned, I think
the basic or windows mode may appropriate for the intranet situation. As
for the internet based web application, those no OS dependant
authentication mode such as "Forms" or "Passport" maybe more proper. For
detailed discusion on the Authenticaion mode in ASP.NET , you may view the
following tech articles in MSDN:
#Building Secure ASP.NET Applications: Authentication, Authorization, and
Secure Communication

http://msdn.microsoft.com/library/en...MSDN.asp?frame
=true

Hope it is helpful.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #8
Hi Nick,

Thanks for your response. I'm glad you've figured out the actual problem.
As for the Authenticaion Mode and the "circular page reference" problem you
mentioned. Here is my suggestion:

I think the Form Authentication is a very convenient and flexible means of
authentication since it provide a simple implementation and custom account
checking(via custom database or other user list). The problem cause the
circular page is that the custom error page is authentication protected so
that unauthenticated user we be redirect to login page. I've also used the
FormAuthentication before , and use a common custom error page. My solution
is to set all those common pages such as "register page" , "about page" or
"custom error page", "custom success info page" 's permission as
<alow user="*"> , only set strict permission for certain part of
pages(which may have important infos)
Thus, the unauthenticated users(anonymous) can also visit those those
common page.
How do you think of this?

In addition, as for the other authentication mode you mentioned, I think
the basic or windows mode may appropriate for the intranet situation. As
for the internet based web application, those no OS dependant
authentication mode such as "Forms" or "Passport" maybe more proper. For
detailed discusion on the Authenticaion mode in ASP.NET , you may view the
following tech articles in MSDN:
#Building Secure ASP.NET Applications: Authentication, Authorization, and
Secure Communication

http://msdn.microsoft.com/library/en...MSDN.asp?frame
=true

Hope it is helpful.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #9
Hi Nick,

Have you had a chance to try out my suggestion or have you resolved the
problem? As for setting different access role for
different page or folder in the web.config I mentioned in the last reply,
I've found a KB article which detailedly focus on this topic, I believe it
will be helpful to you:

#HOW TO: Control Authorization Permissions in an ASP.NET Application
http://support.microsoft.com/?id=316871

If you need any further assistance, please feel free to let me know.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark Metzner | last post by:
We currently have custom error logging setup on all of our websites. We have IIS setup to redirect to our custom 500-100.asp page which logs the error to a database and then redirects to a...
16
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
1
by: Tamas Demjen | last post by:
I started to experiment with VC++ 2005 Beta1. So far everything went fine, and already have a working project, but soon I realized that the compiler was ancient (not supporting half of the C++/CLI...
0
by: Rhys666 | last post by:
OK, an issue I've come across before, but never found a cause for or resolution of, has decided to become the bane of my life again with ASP.Net Custom Error Pages. Basically, my web application...
3
by: Mr Newbie | last post by:
I'm testing error handling configurations and having some trouble. I created a WebForm called. ErrDefault.aspx and I am trying to use the Page error attribute to force the redirection to a custom...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
6
by: Steve Amey | last post by:
Hi all I want to be able to throw a custom error up the call stack. I have looked around and it seems as though it's possible, but I can't get it to work :o( Below is some sample code. ...
2
by: John | last post by:
Hi I was working fine with create user wizard and the default membership provider. I have now customised the membership provider as per attached web.config. The create user wizard picks up the...
6
by: Jeff Hegedus | last post by:
I have a dll that requires some configuration data. I put the configuration data in a custom configuration section in a config file that is loaded in the installation folder of the dll. If I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.