Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Special Edition by Bill Evjen, Scott Hanselman, Devin Rader, Farhan Muhammad, Srinivasa Sivakumar; ISBN: 9780470041789
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #11 (permalink)  
Old February 17th, 2012, 05:05 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Hi there,

Can you provide a bit more information about your actual setup? E.g. what type of web application and module, and how you're calling this code and when?

The code by itself should run fine, provided that HttpContext is available, so it must be the way this code is called that's causing the problem.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #12 (permalink)  
Old February 17th, 2012, 05:33 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Its a web application, 3 tiered architecture: Backend/Database (Oracle 11g), Application Core (vb.net classes and modules), and Interface (ASP.NET 4.0).

The application core does not have any ASP.Net code, its purely VB.Net namespaces that implements how the application interfaces with the database, it also has the data classes. I have a general error handler module (by module I mean a vb module file not subsystem, so that the core can call the error handling methods without fully qualified names) to handle the application errors and log proper messages in the database, then would "redirect" the user to the application Error page (ASP.Net).

They are in different folders, folder Structure:
1- The ErrorPage.aspx is in the application root folder
2- modErrorHanlder.vb is in \Core

This pretty much describes the setup and flow. Is this sufficient to help you help me?

Thanks
Jafar
  #13 (permalink)  
Old February 17th, 2012, 09:19 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Could it be that the error handler is called for situation outside of the user context? E.g. at places where there is no current Request? This could be the case for errors in Application_Start for example.

Can you test for HttpContext.Current being Nothing?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #14 (permalink)  
Old February 20th, 2012, 09:44 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi,

reading your reply made me do the following test:
1- I explicitly invoked my module.ShowErrorPage from my Default.aspx load event, and it worked fine
2- then I redid the scenario (described in my previous posts), in which the ShowErrorPage is being invoked from a data class method which was called from an ASP.Net page code behind page, and this time it did redirect me to the errorpage (to be honest I am not sure if this was always the case or not, last week I was debugging it and as soon as I get the exception I would stop the program) but I also still got the "unable to evaluate expression" exception on the Redirect line? I am passing the error message via the session, would that have anything to do with it?

To answer your question, in both 1 and 2, the HttpContext.Current had a value.

"Could it be that the error handler is called for situation outside of the user context? E.g. at places where there is no current Request? ": the calls for ShowErrorPage come from ASP.Net pages or the data classes, but all the ones from the data classes, initially comes from ASP.Net pages, wouldnt this mean that there always should be a request?

Thanks
Jafar

Last edited by JafarKofahi; February 20th, 2012 at 09:49 AM.
  #15 (permalink)  
Old February 22nd, 2012, 02:04 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Quote:
initially comes from ASP.Net pages, wouldnt this mean that there always should be a request?
Yes, when executed from an ASPX page, there should be an HttpContext.

Does the error only happen in the debugger or at run-time as well?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #16 (permalink)  
Old February 23rd, 2012, 10:57 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Yes it happens at runtime and when debugging

Jafar
  #17 (permalink)  
Old February 28th, 2012, 03:06 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Not sure why this wouldn't work. Sorry...

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
JafarKofahi (February 28th, 2012)
  #18 (permalink)  
Old February 28th, 2012, 07:01 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thats fine..thanks for your time
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
response.redirect sarah lee ASP.NET 1.0 and 1.1 Basics 1 October 27th, 2006 09:57 AM
response.redirect ava_h .NET Framework 2.0 0 October 18th, 2006 11:21 PM
Response.Redirect + Javascript jfergy Classic ASP Basics 2 January 17th, 2006 09:17 PM
response.redirect crmpicco Classic ASP Basics 3 February 9th, 2005 01:50 AM
Response.Redirect dhborchardt Classic ASP Basics 4 June 16th, 2003 06:56 AM



All times are GMT -4. The time now is 03:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.