473,657 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:

"HTTPExcept ion 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.ToSt ring & _
"\nURL: " & Request.Path & _
"\nSOURCE: " & ex.Source.ToStr ing & _
"\nFORM: " & Request.Form.To String() & _
"\nQUERYSTR ING: " & Request.QuerySt ring.ToString() & _
"\nTARGETSI TE: " & ex.TargetSite.T oString & _
"\nSTACKTRA CE: " & ex.StackTrace.T oString & _
EventLogEntryTy pe.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 1033
Your long concatentated string refers to the Request object twice:
"\nFORM: " & Request.Form.To String() & _
"\nQUERYSTR ING: " & Request.QuerySt ring.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****@christi an.net> wrote in message
news:up******** ******@TK2MSFTN GP03.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:

"HTTPExcept ion 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.ToSt ring & _
"\nURL: " & Request.Path & _
"\nSOURCE: " & ex.Source.ToStr ing & _
"\nFORM: " & Request.Form.To String() & _
"\nQUERYSTR ING: " & Request.QuerySt ring.ToString() & _
"\nTARGETSI TE: " & ex.TargetSite.T oString & _
"\nSTACKTRA CE: " & ex.StackTrace.T oString & _
EventLogEntryTy pe.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
9508
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 errors below. Everything compiles fine and all the types are defined, it appears that the template type itga::order_collection::iterator is causing the trouble. Gary.
15
5336
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 path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
0
2641
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 message. This will provide our users the ability to send the crash report to Microsoft, which in turn will allow us to get it. We did a search for Visual Studio help to see what that might turn up and came across the “ReportFault”...
2
1703
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 conversion automatically created an abstract base class for the header in the Migrated folder of the App_Code directory. One of the major problems this caused was regarding the fact that I pass the header to a standard error handling class to process the...
13
3322
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 but I tried it and still get the error. I do not have SQL Server 2005 installed (thought I did once). I do have SQL Server 2008 installed. I don't see anywhere in the code where SQL Server 2005 is referenced.
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.