Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
| Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 21st, 2005, 01:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Arlington, TX, USA.
Posts: 119
Thanks: 0
Thanked 1 Time in 1 Post
Default Modifying the WEB.CONFIG custom error element?

In my default application I have the web.config file however I want to modify the custom errors section whereby if i am working in the development server then the custom errors will NOT be redirected to my custom page and if I am not in the development server then yes go ahead and redirect my user to the custom error page. I thought by using the KEYS in my configuration settings within my web.config file I could add that as an attribute to my custom errors element but I found out it does not work that way.

Here is my web.config setting in the custom errors element:

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

I had tried using this but it failed:

<customErrors environment="prod" mode="On" defaultRedirect="/errorhandle/errorhandle.aspx"/>

environment was one of the keys I have currently in my configuration settings/add appkeys element.

Coming from an VBScript background I could just wrap this statement in an IF ELSE STATEMENT but I can't seem to do that in this environment.

Any suggestions or direction on how I can do this would be appreciated.

Thanks.
  #2 (permalink)  
Old January 21st, 2005, 01:06 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't think you can do this.

The schema for the Web.Config is pretty much defined inside the .NET runtime. (Except for the keys you can add to the AppSettings section)

The only thing I can think of is disable the custom errors functionality and implement your own in Application_Error() but that kind of defeats the purpose.... ;)

Imar
  #3 (permalink)  
Old January 21st, 2005, 02:25 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Of course, you could also just set <customErrors mode="RemoteOnly" ...>

This way you'll see errors when working on development (http://localhost) but not otherwise.

-Peter
  #4 (permalink)  
Old January 21st, 2005, 02:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Arlington, TX, USA.
Posts: 119
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks for the feedback guys. I did have code in the GLOBAL.asax file in each of the IIS application I have on this one solution in VS but really just wanted one place to control the settings for all our .aspx pages. We just decided to turn on and off depending on the environment.

I appreciate your time and feedback.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web.config or IIS Custom Error Need to Reset vinod_yadav1919 ASP.NET 1.0 and 1.1 Basics 2 April 25th, 2008 07:45 AM
modifying web.config through code behind ms_kout ASP.NET 2.0 Professional 1 October 21st, 2007 02:34 PM
web.config error koco ASP.NET 2.0 Basics 1 February 16th, 2007 12:04 PM
error at web.config aynajus BOOK: ASP.NET Website Programming Problem-Design-Solution 2 August 16th, 2006 03:24 AM
Web.config error ashokparchuri General .NET 4 June 28th, 2005 04:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.