Can't access Class when published

G

Guest

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
 
B

bruce barker \(sqlwork.com\)

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)
 
G

Guest

"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.Decrement(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.
 
S

Steven Cheng[MSFT]

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/BlogsDotNetNuke/tabid/825/EntryID/240/De
fault.aspx

http://groups.google.com/group/microsoft.public.dotnet.framework.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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.

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



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

Guest

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
 
S

Steven Cheng[MSFT]

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.
 
G

Guest

The dll does appear in the "bin" folder. I will send you a mini project for
you to try locally.
 
S

Steven Cheng[MSFT]

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.
 
S

Steven Cheng[MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top