Need help.
I create a vb file in my app_code folder. Here is the code:
Imports Microsoft.VisualBasic
Imports System.Net.Mail
Public Class email_error
Public Function Send_Error(ByVal str_Page As String, ByVal str_Message
As String, _
ByVal str_SQL As String, ByVal str_StackTrace As String, _
ByVal str_ExString As String) As String
Dim str_Error As String = ""
Dim str_eMail As String = "XXXXXXXXX"
Dim mail As New MailMessage(str_eMail, str_eMail)
mail.IsBodyHtml = True
mail.Subject = "Outside Web Error " & str_Page
str_Error = "<b>Page:</b><br>" & str_Page & "<br><br>" _
& "<b>Message:</b><br>" & str_Message & "<br><br>" _
& "<b>SQL String:</b><br>" & str_SQL & "<br><br>" _
& "<b>Everything:</b><br>" & str_ExString & "<br><br>" _
& "<br><b>StackTrace:</b>:<br>" & str_StackTrace
mail.Body = str_Error
Dim instance As New SmtpClient("XXXXXX")
instance.Send(mail)
Return str_Error
End Function
End Class
Then I call this code like this:
Dim myEmail As New email_error
myEmail.Send_Error(Request.ServerVariables("Path_I nfo"), ex.Message,
strSQL, ex.StackTrace.ToString, ex.ToString)
All of this works just fine UNLESS the folder that the file with this
code is an application in IIS. If I remove the application it works
but everything else starts blowing up.
The error I get when I have the application created is this:
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'email_error' is not defined.
With this line highlighted:
Dim myEmail As New email_error
Does anyone have any ideas?
Thanks in advance. 10 6036
Are you saying that it doesn't work when the app_code directory is marked as
an application in IIS?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."
<ma********@myrapidsys.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com... Need help.
I create a vb file in my app_code folder. Here is the code:
Imports Microsoft.VisualBasic Imports System.Net.Mail
Public Class email_error
Public Function Send_Error(ByVal str_Page As String, ByVal str_Message As String, _ ByVal str_SQL As String, ByVal str_StackTrace As String, _ ByVal str_ExString As String) As String
Dim str_Error As String = "" Dim str_eMail As String = "XXXXXXXXX"
Dim mail As New MailMessage(str_eMail, str_eMail)
mail.IsBodyHtml = True
mail.Subject = "Outside Web Error " & str_Page
str_Error = "<b>Page:</b><br>" & str_Page & "<br><br>" _ & "<b>Message:</b><br>" & str_Message & "<br><br>" _ & "<b>SQL String:</b><br>" & str_SQL & "<br><br>" _ & "<b>Everything:</b><br>" & str_ExString & "<br><br>" _ & "<br><b>StackTrace:</b>:<br>" & str_StackTrace
mail.Body = str_Error
Dim instance As New SmtpClient("XXXXXX")
instance.Send(mail)
Return str_Error
End Function End Class
Then I call this code like this:
Dim myEmail As New email_error
myEmail.Send_Error(Request.ServerVariables("Path_I nfo"), ex.Message, strSQL, ex.StackTrace.ToString, ex.ToString)
All of this works just fine UNLESS the folder that the file with this code is an application in IIS. If I remove the application it works but everything else starts blowing up.
The error I get when I have the application created is this:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'email_error' is not defined.
With this line highlighted:
Dim myEmail As New email_error
Does anyone have any ideas?
Thanks in advance.
No, it doesnt work when the folder that the code calling the class is
in is marked as an application.
Well all the code works fine if i remove the application in IIS from
the folder holding my web code (i.e. Page in folder "web_pages" called
"test_email", if i remove the IIS application from "web_pages"
everything works great with calling the class in "App_Code", once I
re-apply the application I get the "Type 'email_error' is not defined."
The App_Code subdirectory shouldn't be marked as an application. It is
strictly dependent on the main website application.
If this isn't what is happening, then please elaborate further.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."
<ma********@myrapidsys.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... No, it doesnt work when the folder that the code calling the class is in is marked as an application.
the App_Code directory is not marked as an application, just the
directory with all my aspx files in it. And thats what is not working.
folder "web_pages" contains all my aspx files. Some of those files
are calling a class in the App_Code folder. Intellisense knows about
the class in the .vb file in the App_Code folder and the functions in
that class. So that all works, and building the website shows no
errors. But when I hit the web page I get the "Type is not defined"
error.
Are you using namespaces?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."
<ma********@myrapidsys.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com... here is a test page i put up to display the error:
http://www.asr.co.pima.az.us/APIQ/error_handling.aspx
yes i am using them thru web.config
<namespaces>
<add namespace="System"/>
<add namespace="System.Configuration"/>
<add namespace="System.Web"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.Image"/>
<add namespace="System.Web.UI.HTMLControls"/>
<add namespace="System.Collections"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Math"/>
<add namespace="Microsoft.VisualBasic"/>
<add namespace="System.Configuration"/>
<add namespace="System.Data"/>
<add namespace="System.Data.SqlClient"/>
<add namespace="System.Net.Mail"/>
</namespaces>
I meant in the files in your App_Code subdirectory.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."
<ma********@myrapidsys.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com... yes i am using them thru web.config
<namespaces> <add namespace="System"/> <add namespace="System.Configuration"/> <add namespace="System.Web"/> <add namespace="System.Web.UI"/> <add namespace="System.Web.UI.WebControls"/> <add namespace="System.Web.UI.WebControls.Image"/> <add namespace="System.Web.UI.HTMLControls"/> <add namespace="System.Collections"/> <add namespace="System.Text.RegularExpressions"/> <add namespace="System.Math"/> <add namespace="Microsoft.VisualBasic"/> <add namespace="System.Configuration"/> <add namespace="System.Data"/> <add namespace="System.Data.SqlClient"/> <add namespace="System.Net.Mail"/> </namespaces> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jay Douglas |
last post by:
I have a set of pages that inherit from a base class in the App_Code folder.
The class looks something like:
public class MyBaseClass : System.Web.UI.Page
In various stages of the life cycle I...
|
by: walter |
last post by:
Hi, when I add a new page in my asp.net 2 project and put some controls
there, everything works fine until I move the code behind into App_Code
folder.--When I compile , it tells me that control...
|
by: sck10 |
last post by:
Hello,
I created a class (public class General) with the following. My question
is, is this good practice to have a group of methods(?) in one class, or
should I have a separate class for each...
|
by: pradeep_TP |
last post by:
Hello,
I am trying to use APP_CODE folder for all my class files under VS 2005.
After adding APP_CODE in the solution explorer, I added a new web page by
right clicking project and selecting add...
|
by: rn5a |
last post by:
Is putting a VB class file in the special directory named App_Code the
same as relocating the VB class file from the App_Code directory to
another directory & then using the VBC tool, compiling the...
|
by: netasp |
last post by:
hi all,
when adding a new web form in VS 2003, usually viewing the code behind for
that form will let you write any method or function and referencing any web
control placed on the form without...
|
by: TonyBushell |
last post by:
Hi All,
I need some help with the following:
I am building a CMS to bolt onto an existing website. The CMS will be
uploaded to the existing site off a folder say CMS_ADMIN/ for
example.
...
|
by: Randy |
last post by:
I've converted a VS 2003 project to VS 2005. I have one utility class that
it put in the APP_CODE directory. When I try and compile I'm getting this
error...
Error 1 The type or namespace name...
|
by: Frinavale |
last post by:
I created a custom class that inherits from the CheckBoxList.
I placed the the code for this in the App_Code folder because it's used through out my web application.
I ran into a namespace...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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,...
|
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...
|
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,...
|
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...
| |