473,378 Members | 1,492 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,378 software developers and data experts.

Error on old code converted to VS 2005

I had some old code set to throw an email to me when a user hit an
exception.

VS 2003 worked fine with the code, VS 2005 when I run it in debug mode
pauses over the code each time, and gives me the message:

"HTTPException was unhandled by user code. Request Not Available in
this context."

This is the code that it says it doesn't like:

log2.WriteEntry("Remlink" & _
"MESSAGE: " & ex.Message.ToString & _
"\nURL: " & Request.Path & _
"\nSOURCE: " & ex.Source.ToString & _
"\nFORM: " & Request.Form.ToString() & _
"\nQUERYSTRING: " & Request.QueryString.ToString() & _
"\nTARGETSITE: " & ex.TargetSite.ToString & _
"\nSTACKTRACE: " & ex.StackTrace.ToString & _
EventLogEntryType.Error)

Basically, all I am doing is determining which log to write the event to
above, and then the code for the mail follows this code here.

Why is this thing now barfing on that particular line of code? Anything
I've found referencing the specific message has not been of any help.
Any ideas?
May 15 '06 #1
1 1025
Your long concatentated string refers to the Request object twice:
"\nFORM: " & Request.Form.ToString() & _
"\nQUERYSTRING: " & Request.QueryString.ToString() & _
The change that you made appears to be more than just a recompile. This
code is part of a routine that you are now calling from a service or some
other code that is not running in ASP.Net context. Therefore, the Request
object is not available. If you are not in ASP.Net, then there is no form
or querystring, so these values are not valuable anyway. You may want to
refactor your routine to pass in the parameters you want, and then have the
calling code pass in either the asp.net bits when calling from a web page,
or pass in empty strings when calling from a non-asp.net context.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Blasting Cap" <go****@christian.net> wrote in message
news:up**************@TK2MSFTNGP03.phx.gbl...I had some old code set to throw an email to me when a user hit an
exception.

VS 2003 worked fine with the code, VS 2005 when I run it in debug mode
pauses over the code each time, and gives me the message:

"HTTPException was unhandled by user code. Request Not Available in this
context."

This is the code that it says it doesn't like:

log2.WriteEntry("Remlink" & _
"MESSAGE: " & ex.Message.ToString & _
"\nURL: " & Request.Path & _
"\nSOURCE: " & ex.Source.ToString & _
"\nFORM: " & Request.Form.ToString() & _
"\nQUERYSTRING: " & Request.QueryString.ToString() & _
"\nTARGETSITE: " & ex.TargetSite.ToString & _
"\nSTACKTRACE: " & ex.StackTrace.ToString & _
EventLogEntryType.Error)

Basically, all I am doing is determining which log to write the event to
above, and then the code for the mail follows this code here.

Why is this thing now barfing on that particular line of code? Anything
I've found referencing the specific message has not been of any help.
Any ideas?

May 17 '06 #2

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

Similar topics

10
by: Gary Hughes | last post by:
I'm getting the following error when attempting to link a managed C++ dll. I can't find any reference to these errors with google. Can anyone help? I've included the class definition causing the...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
by: Joshua V. | last post by:
We are trying to implement Windows Error Reporting from within our VB.Net application. Basically we want to replace the standard unhandled exception message we use with the Windows Error Reporting...
2
by: DCC700 | last post by:
VS 2005 Converted Header causing error when publishing After converting from Visual Studio 2003 to 2005, I have had several issues with a header that is used throughout the project. The...
13
by: AAaron123 | last post by:
I downloaded the personal website starter kit and when I run it I get the error shown below. I found a way of using Launch Surface Area Configuration that is supposed to fix the remote setting...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.