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

Can't access Class when published

In my design environment this works fine, but when I deploy it I get an error.

I have a class "MessageBox" defined in my "App_Code" folder. My aspx file
contains the line "Imports MessageBox" at the top.

When I deploy and run the website I get the following error.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
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: BC30451: Name 'MessageBox' is not declared.

Source Error:

Line 64: End If
Line 65: Catch ex As Exception
Line 66: MessageBox.Show(Err.Number & " - " & Err.Description &
": denyHistory")
Line 67: End Try
Line 68: End Function
Oct 16 '06 #1
8 2829
you have two errors.

1) to compile the site with messagebox, you need to add a reference to
System.Windows.Forms.dll
2) the Messagebox class will not work with asp.net due to security issues.
Messagebox requires access to the desktop and services don't have access.

-- bruce (sqlwork.com)

"Herb" <Ju********@newsgroups.nospamwrote in message
news:B9**********************************@microsof t.com...
In my design environment this works fine, but when I deploy it I get an
error.

I have a class "MessageBox" defined in my "App_Code" folder. My aspx file
contains the line "Imports MessageBox" at the top.

When I deploy and run the website I get the following error.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
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: BC30451: Name 'MessageBox' is not declared.

Source Error:

Line 64: End If
Line 65: Catch ex As Exception
Line 66: MessageBox.Show(Err.Number & " - " & Err.Description
&
": denyHistory")
Line 67: End Try
Line 68: End Function


Oct 16 '06 #2
"MessageBox" in this case is a Class that I have defined. It actually uses
the JavaScript "alert" by dynamically building code. It does not use
Sys.Win.forms

code snippet:
sb.Append("<script language='javascript'>")
Dim sMsg As String
While System.Math.Max(System.Threading.Interlocked.Decre ment(iMsgCount),
iMsgCount + 1) 0
sMsg = CType(queue.Dequeue, String)
sMsg = sMsg.Replace("" & Microsoft.VisualBasic.Chr(10) & "", "\n")
sMsg = sMsg.Replace("""", "'")
sb.Append("alert( """ + sMsg + """ );")
End While
sb.Append("</script>")

Thanks.

"bruce barker (sqlwork.com)" wrote:
you have two errors.

1) to compile the site with messagebox, you need to add a reference to
System.Windows.Forms.dll
2) the Messagebox class will not work with asp.net due to security issues.
Messagebox requires access to the desktop and services don't have access.

-- bruce (sqlwork.com)

"Herb" <Ju********@newsgroups.nospamwrote in message
news:B9**********************************@microsof t.com...
In my design environment this works fine, but when I deploy it I get an
error.

I have a class "MessageBox" defined in my "App_Code" folder. My aspx file
contains the line "Imports MessageBox" at the top.

When I deploy and run the website I get the following error.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
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: BC30451: Name 'MessageBox' is not declared.

Source Error:

Line 64: End If
Line 65: Catch ex As Exception
Line 66: MessageBox.Show(Err.Number & " - " & Err.Description
&
": denyHistory")
Line 67: End Try
Line 68: End Function


Oct 16 '06 #3
Hello Junior,

As for the ASP.NET 2.0 web project, how did you deploy it, are you using
the Publish Web site to precompile it or directly xcopy the original web
site to the target place?

Based on my experience, those class & code in App_code can be directly
referenced by any page or usercontrol in the web application with out
explicitly use Imports directive. Did you manually add namespace for the
classes in the App_code folder? Would you provide me the complete source
code file of that Message class and the page that use it? Or if
convenient, you can create a simpflied web project contains the necessary
page, components that can reproduce the issue. And you can send it to me so
that I can perform some local test on it. (you can reach me through the
email in my signature by removing "online").

In addition, here are some web threads I've found discussing on similar
error, you can also have a reference:

http://www.dotnetnuke.com/Community/...EntryID/240/De
fault.aspx

http://groups.google.com/group/micro...rk.aspnet/brow
se_thread/thread/fd39fe502a56244c/a8a6ffd8bf81eeb7

Please feel free to let me know if you meet any new problem or there is any
other questions.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 17 '06 #4
Steven,

Thanks for your reply. I have tried both xcopy and Publish. I have manually
added the namespace entry in the web.config:
<add namespace="MessageBox"/>

When I xcopy I get the originally posdted error. When I publish I get the
error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: Could not load the assembly 'App_Web_-6w8xwkz'. Make
sure that it is compiled before accessing the page.

Source Error:
Line 1: <%@ page language="VB" autoeventwireup="false" inherits="_Default,
App_Web_-6w8xwkz" %>
Line 2:
Line 3: <%@ Register Assembly="Infragistics2.WebUI.WebDataInput.v6.2,
Version=6.2.20062.34, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Source File: /BEAR/default.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42

"Steven Cheng[MSFT]" wrote:
Hello Junior,

As for the ASP.NET 2.0 web project, how did you deploy it, are you using
the Publish Web site to precompile it or directly xcopy the original web
site to the target place?

Based on my experience, those class & code in App_code can be directly
referenced by any page or usercontrol in the web application with out
explicitly use Imports directive. Did you manually add namespace for the
classes in the App_code folder? Would you provide me the complete source
code file of that Message class and the page that use it? Or if
convenient, you can create a simpflied web project contains the necessary
page, components that can reproduce the issue. And you can send it to me so
that I can perform some local test on it. (you can reach me through the
email in my signature by removing "online").

In addition, here are some web threads I've found discussing on similar
error, you can also have a reference:

http://www.dotnetnuke.com/Community/...EntryID/240/De
fault.aspx

http://groups.google.com/group/micro...rk.aspnet/brow
se_thread/thread/fd39fe502a56244c/a8a6ffd8bf81eeb7

Please feel free to let me know if you meet any new problem or there is any
other questions.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 17 '06 #5
Thanks for your reply Herb,

It seems the compilation of the helper clas code. Based on the error info
you provided when using publish WebSite to deploy the application, it
failed to load the following precompiled assembly:

App_Web_-6w8xwkz

Have you checked the precompiled application's bin directory to see whether
this assembly exists? If not, that means there is some problem occur at the
dynamic compilation that prevent the assembly being generated.

BTW, I also would like to perform some test on my local side, is it
convenient that you create a simplified reproduce project and send it to me
via email?

Please feel free to let met know if you have any questions or concerns.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 18 '06 #6
The dll does appear in the "bin" folder. I will send you a mini project for
you to try locally.

"Steven Cheng[MSFT]" wrote:
Thanks for your reply Herb,

It seems the compilation of the helper clas code. Based on the error info
you provided when using publish WebSite to deploy the application, it
failed to load the following precompiled assembly:

App_Web_-6w8xwkz

Have you checked the precompiled application's bin directory to see whether
this assembly exists? If not, that means there is some problem occur at the
dynamic compilation that prevent the assembly being generated.

BTW, I also would like to perform some test on my local side, is it
convenient that you create a simplified reproduce project and send it to me
via email?

Please feel free to let met know if you have any questions or concerns.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 18 '06 #7
Hi Herb,

I've received your repro package, however, when I try extracting the zip
file, it prompt for encryption password. Would you resend me a unencrypted
one or send me the password also?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 19 '06 #8
Hello Herb,

I've peformed some tests through the test project you sent me, it seems
that I haven't got the exact error you encountered. here is my test steps:

** open the project through filesystem web project

** build and run the project in VS 2005 IDE(test server) , no problem

** Use "publish web site" to precompile the website(updatable) and deploy
it into IIS, run it without any problem

Is this also the exact steps you do in your environment? If so, I think
this could be an environment specific issue. You can also test it on some
other machines to see whether the same behavior occur.

Please feel free to let me know if you have any other finding or if
anything we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Oct 22 '06 #9

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

Similar topics

4
by: Edward Diener | last post by:
Version 2.0 of the Python database API was written over 5 years ago, in 1999. While it has been used successfully by many implementations, there is no generic access into the data dictionary of...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
6
by: Jules | last post by:
Hi: I have an Access 97 Search form set up - a couple of combo boxes, a couple of text fields and a command button. I want the command button to run an SQL script and then open the results form....
10
by: esara | last post by:
What do I need to start learning ACCESS.. what is the prerequest... I am familair with Windows O/S and C/C++ as a students and I am old 38.. Do I need to know VB?? Can I start from scratch.. I am...
7
by: Adam Barnett via AccessMonster.com | last post by:
I have an Access application split into a FE and BE with a workgroup file (.mdw) for authentication. I currently have the FE application setup as a published application for 40 users. We have been...
13
by: bonk | last post by:
Hello, I am trying to create a dll that internally uses managed types but exposes a plain unmanaged interface. All the managed stuff shall be "wrapped out of sight". So that I would be able to...
52
by: lovecreatesbeauty | last post by:
Why the C standard committee doesn't provide a standard implementation including the C compiler and library when the language standard document is published? C works on the abstract model of low...
1
by: ThunderMusic | last post by:
Hi, I have many classes a user may need to call methods on my webservice. Some classes are "published" and some are not... I mean, when we do a Web reference from another project, we don't have...
2
by: gimme_this_gimme_that | last post by:
What is the best VBA/Access book for an experienced VBA programmer? I'd prefer something that is less than 350 pages. Thanks.
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...
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...
0
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,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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 project—planning, coding, testing,...

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.