I'm trying to convert a 1.1 app to 2.0, and keep finding one thing after
another that either Framework 2.0 or Visual Studio 2005 doesn't like.
Now this -
In the global.asax, code that has been running for nearly 4 years now is
giving me a problem. The code is supposed to give the user a "clean"
page with a login link on it and send an email to me when an app blows
up. It also is supposed to write to the event log too.
This is the code:
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)
Dim Message As String = "\n\nURL:\n http://localhost/" &
Request.Path _
& "\n\nMESSAG E:\n "
& Server.GetLastE rror().Message _
& "\n\nSTACK
TRACE:\n" & Server.GetLastE rror().StackTra ce
' Create event log if it does not exist
'Message = Server.GetLastE rror().ToString
Dim LogName As String = "Applicatio n"
If (Not EventLog.Source Exists(LogName) ) Then
EventLog.Create EventSource(Log Name, LogName)
End If
' Insert into event log
Dim Log As New EventLog
Log.Source = LogName
Log.WriteEntry( Message, EventLogEntryTy pe.Error)
Dim mail As New MailMessage
Dim sTemp As String = Replace(Session ("UserName") , " ", ".")
sTemp = sTemp & "@mycompany.com "
mail.From = New MailAddress(sTe mp)
mail.To.Add("we *@mycompany.com ")
mail.Subject = "mycompany. com Site Error"
mail.Body = Request.Path & " " & Server.GetLastE rror().ToString
mail.IsBodyHtml = True
Dim smtp As New SmtpClient
smtp.Send(mail)
End Sub
The statement that generates the error is the firs one - the dim Message
as String.
The error is:
"HTTPExcept ion was unhandled by user code"
"Request is not available in this context"
If I do a quickwatch on the Server.GetLastE rror().Message, it returns:
"Exception from HRESULT: 0x800A0035 (CTL_E_FILENOTF OUND)"
The error appears to occur when my web app looks at the server (the www
external name), on which we have challenge/response set on, for a
graphic that I use on the page. I've stepped thru the code on the page,
and it only goes to the Application_err or step in Global.asax when the
page tries to display the first of the two graphics that are on the www
external name. It doesn't occur anywhere else.
This code has been functioning on 1.1 framework & Visual Studio 2003 for
several years without a hitch, and had previously been tested by me on
this box and another one without a problem.
What gives with this new message? Why is it picking this error to give
me a problem with?
Any ideas, suggestions appreciated.
BC 6 4808
On May 16, 5:41 pm, Blasting Cap <goo...@christi an.netwrote:
I'm trying to convert a 1.1 app to 2.0, and keep finding one thing after
another that either Framework 2.0 or Visual Studio 2005 doesn't like.
Now this -
In the global.asax, code that has been running for nearly 4 years now is
giving me a problem. The code is supposed to give the user a "clean"
page with a login link on it and send an email to me when an app blows
up. It also is supposed to write to the event log too.
This is the code:
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)
Dim Message As String = "\n\nURL:\nhttp ://localhost/" &
Request.Path _
& "\n\nMESSAG E:\n "
& Server.GetLastE rror().Message _
& "\n\nSTACK
TRACE:\n" & Server.GetLastE rror().StackTra ce
' Create event log if it does not exist
'Message = Server.GetLastE rror().ToString
Dim LogName As String = "Applicatio n"
If (Not EventLog.Source Exists(LogName) ) Then
EventLog.Create EventSource(Log Name, LogName)
End If
' Insert into event log
Dim Log As New EventLog
Log.Source = LogName
Log.WriteEntry( Message, EventLogEntryTy pe.Error)
Dim mail As New MailMessage
Dim sTemp As String = Replace(Session ("UserName") , " ", ".")
sTemp = sTemp & "@mycompany.com "
mail.From = New MailAddress(sTe mp)
mail.To.Add("w. ..@mycompany.co m")
mail.Subject = "mycompany. com Site Error"
mail.Body = Request.Path & " " & Server.GetLastE rror().ToString
mail.IsBodyHtml = True
Dim smtp As New SmtpClient
smtp.Send(mail)
End Sub
The statement that generates the error is the firs one - the dim Message
as String.
The error is:
"HTTPExcept ion was unhandled by user code"
"Request is not available in this context"
If I do a quickwatch on the Server.GetLastE rror().Message, it returns:
"Exception from HRESULT: 0x800A0035 (CTL_E_FILENOTF OUND)"
The error appears to occur when my web app looks at the server (the www
external name), on which we have challenge/response set on, for a
graphic that I use on the page. I've stepped thru the code on the page,
and it only goes to the Application_err or step in Global.asax when the
page tries to display the first of the two graphics that are on the www
external name. It doesn't occur anywhere else.
This code has been functioning on 1.1 framework & Visual Studio 2003 for
several years without a hitch, and had previously been tested by me on
this box and another one without a problem.
What gives with this new message? Why is it picking this error to give
me a problem with?
Any ideas, suggestions appreciated.
BC
Hi, if I understand you correct, the original problem is not this
code. The "Request is not available in this context" message means
that the Request was not yet initialized when the error occurred and
you cannot use the Request.Path. Try to add
If Not Request Is Nothing Then
or
IIF(Request Is Nothing, "", Request.Path)
Alexy -
I did as you suggested, adding the IIF statement in the global.asax.
It didn't like that any better, and now produces an error in the task list:
Error 50 Type 'ASP.global_asa x' is not defined.
C:\Inetpub\wwwr oot\test\Sales\ faavailability. aspx 1 1 http://localhost/test/
Alexey Smirnov wrote:
On May 16, 5:41 pm, Blasting Cap <goo...@christi an.netwrote:
>I'm trying to convert a 1.1 app to 2.0, and keep finding one thing after another that either Framework 2.0 or Visual Studio 2005 doesn't like.
Now this -
In the global.asax, code that has been running for nearly 4 years now is giving me a problem. The code is supposed to give the user a "clean" page with a login link on it and send an email to me when an app blows up. It also is supposed to write to the event log too.
This is the code:
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs) Dim Message As String = "\n\nURL:\nhttp ://localhost/" & Request.Path _ & "\n\nMESSAG E:\n " & Server.GetLastE rror().Message _ & "\n\nSTACK TRACE:\n" & Server.GetLastE rror().StackTra ce
' Create event log if it does not exist 'Message = Server.GetLastE rror().ToString Dim LogName As String = "Applicatio n" If (Not EventLog.Source Exists(LogName) ) Then EventLog.Create EventSource(Log Name, LogName) End If
' Insert into event log Dim Log As New EventLog Log.Source = LogName Log.WriteEntry( Message, EventLogEntryTy pe.Error)
Dim mail As New MailMessage Dim sTemp As String = Replace(Session ("UserName") , " ", ".") sTemp = sTemp & "@mycompany.com " mail.From = New MailAddress(sTe mp) mail.To.Add("w. ..@mycompany.co m") mail.Subject = "mycompany. com Site Error" mail.Body = Request.Path & " " & Server.GetLastE rror().ToString mail.IsBodyHtml = True Dim smtp As New SmtpClient smtp.Send(mail) End Sub
The statement that generates the error is the firs one - the dim Message as String.
The error is:
"HTTPExcepti on was unhandled by user code" "Request is not available in this context"
If I do a quickwatch on the Server.GetLastE rror().Message, it returns:
"Exception from HRESULT: 0x800A0035 (CTL_E_FILENOTF OUND)"
The error appears to occur when my web app looks at the server (the www external name), on which we have challenge/response set on, for a graphic that I use on the page. I've stepped thru the code on the page, and it only goes to the Application_err or step in Global.asax when the page tries to display the first of the two graphics that are on the www external name. It doesn't occur anywhere else.
This code has been functioning on 1.1 framework & Visual Studio 2003 for several years without a hitch, and had previously been tested by me on this box and another one without a problem.
What gives with this new message? Why is it picking this error to give me a problem with?
Any ideas, suggestions appreciated.
BC
Hi, if I understand you correct, the original problem is not this
code. The "Request is not available in this context" message means
that the Request was not yet initialized when the error occurred and
you cannot use the Request.Path. Try to add
If Not Request Is Nothing Then
or
IIF(Request Is Nothing, "", Request.Path)
"Blasting Cap" <go****@christi an.netwrote in message
news:ej******** ********@TK2MSF TNGP04.phx.gbl. ..
Alexy -
I did as you suggested, adding the IIF statement in the global.asax.
It didn't like that any better, and now produces an error in the task
list:
Error 50 Type 'ASP.global_asa x' is not defined.
C:\Inetpub\wwwr oot\test\Sales\ faavailability. aspx 1 1 http://localhost/test/
Okay, you see - the problem is different, probably because the conversion
hadn't finished properly
How is your global.asax looks like?
Should be similar to the following:
<%@ Application Codebehind="Glo bal.asax.vb" Inherits="ASP.G lobal_asax"
Language="vb" %>
(ASP is your namespace)
How the Page Directive in the faavailability. aspx looks like?
If you think that everything is correct, try to rename the "wrong" page,
create a new one using VS.NET 2005 and copy your functions to the newly
created file. Maybe this can solve the problem. (I hope)
I've done something similar to what you've suggested, and it seems to
have worked, although I still have some minor issues.
Wonder why this conversion process is so subject to these "odd" errors,
where renaming a page & creating a new one seems to "fix" a problem that
you can't fix any other way?
BC
Alexey Smirnov wrote:
"Blasting Cap" <go****@christi an.netwrote in message
news:ej******** ********@TK2MSF TNGP04.phx.gbl. ..
>Alexy -
I did as you suggested, adding the IIF statement in the global.asax.
It didn't like that any better, and now produces an error in the task list:
Error 50 Type 'ASP.global_asa x' is not defined. C:\Inetpub\www root\test\Sales \faavailability .aspx 1 1 http://localhost/test/
Okay, you see - the problem is different, probably because the conversion
hadn't finished properly
How is your global.asax looks like?
Should be similar to the following:
<%@ Application Codebehind="Glo bal.asax.vb" Inherits="ASP.G lobal_asax"
Language="vb" %>
(ASP is your namespace)
How the Page Directive in the faavailability. aspx looks like?
If you think that everything is correct, try to rename the "wrong" page,
create a new one using VS.NET 2005 and copy your functions to the newly
created file. Maybe this can solve the problem. (I hope)
Hi, Mr. Cap. May I call you Blasting ?
:-)
The heart of what you point out is that no conversion program can possibly
cover all the syntax quirks between the different .Net Framework versions.
You might want to look at a dedicated tool, like a code refactoring app, to get better results.
Refactor! for .NET is a good tool for VB.NET...and it's free: http://www.devexpress.com/Products/N...ls/VBRefactor/
Refactor for ASP.NET is quite useful, too...and it's also free: http://www.devexpress.com/Products/N...s/RefactorASP/
They also have a C# version...but you have to pay for it: http://www.devexpress.com/Products/NET/Refactor/
It does much more than the free versions, though.
Refactor covers a lot of ground, and can save you a few headaches.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Blasting Cap" <go****@christi an.netwrote in message news:eu******** ******@TK2MSFTN GP06.phx.gbl...
I've done something similar to what you've suggested, and it seems to have worked, although I
still have some minor issues.
Wonder why this conversion process is so subject to these "odd" errors, where renaming a page &
creating a new one seems to "fix" a problem that you can't fix any other way?
BC
Alexey Smirnov wrote:
>"Blasting Cap" <go****@christi an.netwrote in message news:ej******* *********@TK2MS FTNGP04.phx.gbl ...
>>Alexy -
I did as you suggested, adding the IIF statement in the global.asax.
It didn't like that any better, and now produces an error in the task list:
Error 50 Type 'ASP.global_asa x' is not defined. C:\Inetpub\ww wroot\test\Sale s\faavailabilit y.aspx 1 1 http://localhost/test/ Okay, you see - the problem is different, probably because the conversion hadn't finished properly
How is your global.asax looks like?
Should be similar to the following: <%@ Application Codebehind="Glo bal.asax.vb" Inherits="ASP.G lobal_asax" Language="vb" %>
(ASP is your namespace)
How the Page Directive in the faavailability. aspx looks like?
If you think that everything is correct, try to rename the "wrong" page, create a new one using VS.NET 2005 and copy your functions to the newly created file. Maybe this can solve the problem. (I hope)
On May 18, 2:53 pm, Blasting Cap <goo...@christi an.netwrote:
I've done something similar to what you've suggested, and it seems to
have worked, although I still have some minor issues.
Wonder why this conversion process is so subject to these "odd" errors,
where renaming a page & creating a new one seems to "fix" a problem that
you can't fix any other way?
BC
Alexey Smirnov wrote:
"Blasting Cap" <goo...@christi an.netwrote in message
news:ej******** ********@TK2MSF TNGP04.phx.gbl. ..
Alexy -
I did as you suggested, adding the IIF statement in the global.asax.
It didn't like that any better, and now produces an error in the task
list:
Error 50 Type 'ASP.global_asa x' is not defined.
C:\Inetpub\wwwr oot\test\Sales\ faavailability. aspx 1 1 http://localhost/test/
Okay, you see - the problem is different, probably because the conversion
hadn't finished properly
How is your global.asax looks like?
Should be similar to the following:
<%@ Application Codebehind="Glo bal.asax.vb" Inherits="ASP.G lobal_asax"
Language="vb" %>
(ASP is your namespace)
How the Page Directive in the faavailability. aspx looks like?
If you think that everything is correct, try to rename the "wrong" page,
create a new one using VS.NET 2005 and copy your functions to the newly
created file. Maybe this can solve the problem. (I hope)- Hide quoted text -
- Show quoted text -
Check out the following two links regarding issues with migrating:
Step-by-Step Guide to Converting Web Projects from Visual Studio .NET
2002/2003 to Visual Studio 2005 http://msdn2.microsoft.com/en-us/library/aa479567.aspx
Common ASP.NET 2.0 Conversion Issues and Solutions http://msdn2.microsoft.com/en-us/library/aa479312.aspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Faheem Mitha |
last post by:
Hi,
I'm not sure what would be more appropriate, so I'm ccing it to both
alt.comp.lang.learn.c-c++ and comp.lang.python, with followup to
alt.comp.lang.learn.c-c++.
While working with a random number generator in the context of a mixed
Python/C++ programming problem. I encountered a vexing type
conversion problem.
|
by: ann |
last post by:
Does somebody know why I get a blank string in strA? Last
time post the wrong code.
"
Option Strict On
Option Explicit On
Public Class Cast
Private Sub FuncA()
|
by: Spam sucks |
last post by:
hello,
i create a logging xml file with dom that could have an unknown count of
results now it is 0 to 7 but it could be i have 14 or 50 results how can you
read this out with xsl, with php you would put it in an array or something
but now i want to do it with xsl.
in php it woul be like:
foreach ($array as $key=>$value)
{
|
by: brett valjalo |
last post by:
Hey Folks:
Long time no see! Hope everyone is well.
I have an old mdb I'm upsizing to an adp. There is a button on a form
which executes code similar to the following (this is a search form
where sql is dynamically generated based on 1-7 criteria fields chosen
by the user):
strSQL = strSQLBase & strWhere & strOrder
|
by: Mika M |
last post by:
Hi!
I try to convert some VB.NET 2003 code into C# 2003 code. Code uses
Sax.Communications COM-port control, and VB code is working fine.
Here is part of VB Class code I'm trying to convert...
Imports Sax.Communications '// Importing component Namespace
Private WithEvents _ComPort As SerialConnection '// Declaration Com-port
| |
by: Michael Tissington |
last post by:
I'm trying to convert a project from VS2003 to VS2005
After conversion all of my TagPrefix are not recognized in the body.
<%@ Register TagPrefix="Oaklodge" TagName="Curve" Src="ctrls/Curve.ascx" %>
This does not report any errors, but when I try to use it like
<Oaklodge:Curve runat="server" />
I get the following error
|
by: egbert.beuker |
last post by:
Hi,
I encountered a conversion problem in my .net web app (c#), and I hope
someone can help me:
I'm working on a generic way to store data in a database with a few
generated classes.
I want to loop through posted values, store them in properties in a
class, and then save the data with the class function "Update", which
by the way works fine.
|
by: ipoxygen |
last post by:
Hi, I do have 6 identical tables on six different databases (same server). I would like to merge them into one single table for reporting purposes.
For the majority of the table it does work without a problem with following procedure:
/*
100: NL
200: BE
300: UK
400: FR
600: SP
|
by: santhescript01 |
last post by:
Unicode to non unicode conversion problem
--------------------------------------------------------------------------------
Hi All,
I am using C dll in macro which converts Unicode data to 8 bit encoding data
' Prototype of C function.
' extern "C" int _stdcall Uni2Eni(wchar_t * uni, unsigned char * eni, int size)
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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...
|
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 project—planning, coding, testing, and deployment—without 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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |