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

Custom VB Class works locally, but not on Web Server for ASP.NET 2.0 Application?

PAHSTeacher
I am using VB in VWD 2005 to write a web application.

I have stored my code for several custom VB classes in the App_Code folder.
When I run my application locally from VWD it runs fine.

When I run the Application from the web server, I get an error from any code from my WebpageName.axpx.vb files that use my class code.

For example, lines such as

Dim MO as new MyObject

Give me the following error
Compiler Error Message: BC30002: Type 'MyObject' is not defined


I have defined MyObject as a public class in the App_Code folder, so I don't understand why I get this error message?

Any insight would be greatly appreciated. To see the error message I am currently receiving, you can go to,

Example

Make a selection and press the button.
Oct 7 '07 #1
10 2723
Hi

i can see here in you example that you have an error after a user has selected an option and click a button.

Dim P As New PageSetup ' the error

PageSetup is a dll, right?
and you referenced that in your local copy?













I am using VB in VWD 2005 to write a web application.

I have stored my code for several custom VB classes in the App_Code folder.
When I run my application locally from VWD it runs fine.

When I run the Application from the web server, I get an error from any code from my WebpageName.axpx.vb files that use my class code.

For example, lines such as

Dim MO as new MyObject

Give me the following error
Compiler Error Message: BC30002: Type 'MyObject' is not defined


I have defined MyObject as a public class in the App_Code folder, so I don't understand why I get this error message?

Any insight would be greatly appreciated. To see the error message I am currently receiving, you can go to,

Example

Make a selection and press the button.
Oct 8 '07 #2
Shashi Sadasivan
1,435 Expert 1GB
is inside some other namespace?

Reference PageSetup from its namespace.


Expand|Select|Wrap|Line Numbers
  1. Dim P As New Namespace.PageSetup
where NameSpace is the namespace in which PageSetup Resides.
cheers
Oct 8 '07 #3
Thank you for your advice,
I don't know a lot about .dll files, so I did not consciously create any. I am still pretty new at .NET and web programming in general. I did not know about namespace before today. I put my classes in a namespace and changed my declarations as per your suggestions. I added an Import Line at the top of each of my Aspx.vb pages to import the namespace. ( I hope this is the correct way to go about this). All is well when I run it in VWD. I will post a response after It's been loaded to the server.

Thank you again for your help.
Oct 8 '07 #4
I am still getting an error, but a slightly different error.

Compiler Error Message: BC30002: Type 'Oct8_2007.PageSetup' is not defined.
and

Warning: BC40056: Namespace or type specified in the Imports 'Oct8_2007' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
To See for the error for yourself click on the link below, make a selection from the drop down and press the button.

Example 2



In ClassesOct82007.VB in my App_Code folder I have the following code (actuall Class Code rolled up for readability):

Imports Microsoft.VisualBasic
Imports System.Data.OleDb
Imports System.Data

Expand|Select|Wrap|Line Numbers
  1. ' Last Edited 10/8/2007
  2. Namespace Oct8_2007
  3.                 Public Class OrganClasses…
  4.                 Public Class DataControl…
  5.                 Public Class LabelControl…
  6.                 Public Class MySearch…
  7.                 Public Class PageSetup…
  8.                 Public Class Selection…
  9.                 Public Class UsageDBClass…
  10.                 Public Class UserDBClass…
  11.                 Public Class DownloadMDBClass…
  12. End Namespace
The relevant code in the Page.asxp.vb file is

Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.OleDb
  2. Imports System.Data
  3. Imports Oct8_2007
  4.  
  5. Partial Class _Default
  6.           Inherits System.Web.UI.Page
  7.           Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  8.             ' Page Load Ver 9/2/2007
  9.             If Not Page.IsPostBack Then
  10.                           Dim P As New Oct8_2007.PageSetup
  11.                           P.SetUpPage(Page, pTableID)
  12.             End If
  13.          End Sub    
  14. End Class
I appreciate any advice you might have.
Oct 8 '07 #5
Does anyone have any advice on how let me use my custom VB classes when I put my project on the server? I don't quite understand why it works with Visual Web Developer, but not when I put my project on the web server?

Does anyone have a link to using custom namespaces?

Am I using the syntax for namespaces incorrectly, or am I conceptually misunderstanding namespaces in general?

Thank you for advice or links you might offer.

~ Dan
Oct 10 '07 #6
Shashi Sadasivan
1,435 Expert 1GB
Have you got a definition for Pagesetup in that namespace?
Oct 10 '07 #7
By definition do you mean code for my PageSetup class? I've pasted (a trimmed down version) of my PageSetup class. I've wrapped in (my understanding of) a Namespace class.

In the .vb code file for each of my Aspx.net web pages I've added an Imports Oct8_2007 statement.

Is that the correct syntax?

In ClassesOct82007.vb contained in the App_Code folder.
Expand|Select|Wrap|Line Numbers
  1. Namespace Oct8_2007
  2.      Public Class PageSetup
  3.         Private pPage As Page
  4.         Private pTableName As String
  5.         Private pCurrentControl As Control
  6.         Private pBadDataMessage As String = ""
  7.         Public oFunctions As New Oct8_2007.OrganClasses
  8.         Public LabelFormatsTable As New DataTable
  9.         Private ChoicesTable As New DataTable
  10.  
  11.         Public Sub SetUpPage(ByVal Page As Page, ByVal TableName As String)
  12.             pPage = Page
  13.             pTableName = TableName
  14.             Dim MS As New Oct8_2007.MySearch
  15.             ChoicesTable = MS.Search("ChoicesDB", TableName, , , , , , , , , "Order")
  16.             'LabelFormatsTable = MS.Search("FormatsdB", TableName, "P", "0")
  17.             Call SetUpChoices()
  18.         End Sub    
  19.     End Class
  20. End Namespace
Oct 11 '07 #8
Shashi Sadasivan
1,435 Expert 1GB
Researched a bit over this.

Are you using DotNetNuke by any chance?
I tried searching for that error code...but all lead to having dotnetnuke in them

Hope someone from that expertise can help you
Oct 11 '07 #9
Not that I'm aware of. I'm not sure what DotNetNuke is.

I've been creating the web project in Visual Web Developer. I will keep researching and post back if I find success. Thank you for your help.


I just wish I knew why it works in VWD but not when I save it to the server.

This is the most closely related post I've found so far is,

http://forums.asp.net/p/1087606/1622594.aspx#1622594

Thanks again.
Oct 11 '07 #10
Shashi,
Thanks for your help. I just wanted to give you an update. I still don't know why it didn't work. But we switched to a different server and it now works just fine. Thanks again for the assistance with namespaces.
Oct 30 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
22
by: TC | last post by:
I have an Access database application with a lot of custom row functions written in VBA. In other words, a lot of queries contain calculated fields which use functions defined in the modules. I...
4
by: Pat | last post by:
In my Web.config i have :- <customErrors mode="On" defaultRedirect="genericerror.htm"> <error statusCode="404" redirect="pagenotfound.aspx"/> </customErrors to get page not found error but...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
5
by: Graham | last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider" that derives from "MembershipProvider". This providor is located in a Businesslogic layer dll called...
8
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
5
by: Alias | last post by:
Hi - I'm trying to implement a custom RoleProvider based on the SqlRoleProvider. I keep receiving a an error that it can't load type 'MyRoleTest.MyRoleProvider' when trying to load my...
3
by: =?Utf-8?B?YWJheWVy?= | last post by:
In short: I have an application using the CommittableTransaction class that works fine when run locally, but does not escalate to MSDTC when deployed to a Windows 2003 R2 server. More...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.