Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET 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
 
Old December 1st, 2004, 01:00 PM
lxi lxi is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default unhanded exceptions – iinside/outside user

In my web application I captured all unhanded exceptions by using the following method:

1)In web.config, add:
<customErrors mode="RemoteOnly" defaultRedirect="error.aspx" />

2)In global.asax.vb, add:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Fires when an error occurs
Dim Mymessage As New MailMessage
SmtpMail.Send("[email protected]", "[email protected]", "Error occurs", Request.Path & Server.GetLastError.ToString())
End Sub

Everything works fine.

As far as I understand, the “RemoteOnly” is an option that only allows users who access the web application from the local machine (localhost) to see the exception information, while all other users will be redirected to the defaultredirect page (“error.aspx” in my case).

My web application is available to company’s intranet users as well as Internet users, how could I allow all users inside the company see the detailed exception information, and redirect all outside users to “error.aspx?

Could I possible detect the user’s IP address at this stage, then according to the use’s IP address to decide whether to redirect the user or not?

Any suggestions would be very appreciated.

Thank you!
 
Old December 1st, 2004, 04:24 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

AFAIK, RemoteOnly means "everything but localhost". This means all other computers will see the friendly error page, and only on localhost can you see the real error message.

Either way, Application_Error will fire, so you can do / check whatever you need to do inside that method.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 2nd, 2004, 06:14 AM
lxi lxi is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you. I shall give it a try.






Similar Threads
Thread Thread Starter Forum Replies Last Post
exceptions Maxxim BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 October 18th, 2008 12:34 PM
When to use Exceptions kcraft Pro PHP 1 January 15th, 2005 02:37 PM
Web Exceptions dotnetprogrammer VS.NET 2002/2003 0 November 3rd, 2004 03:39 AM
throwing exceptions...!? jacob ASP.NET 1.0 and 1.1 Basics 3 October 9th, 2003 03:37 PM
Exceptions and errors nbnelson C# 0 August 5th, 2003 11:24 AM





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