473,796 Members | 2,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

PAHSTeacher
13 New Member
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.axp x.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 2794
aliasruel
73 New Member
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.axp x.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 Recognized Expert Top Contributor
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
PAHSTeacher
13 New Member
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
PAHSTeacher
13 New Member
I am still getting an error, but a slightly different error.

Compiler Error Message: BC30002: Type 'Oct8_2007.Page Setup' 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.Visua lBasic
Imports System.Data.Ole Db
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
PAHSTeacher
13 New Member
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 misunderstandin g namespaces in general?

Thank you for advice or links you might offer.

~ Dan
Oct 10 '07 #6
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Have you got a definition for Pagesetup in that namespace?
Oct 10 '07 #7
PAHSTeacher
13 New Member
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 Recognized Expert Top Contributor
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
PAHSTeacher
13 New Member
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

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

Similar topics

7
4755
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 and is defined in an assembly common to the client and server components. The custom class merely defines three (3) constructors -- the null constructor; one with a string parameter; and one with a string and innner exception parameter -- that...
22
3818
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 am now thinking about upgrading the database from Access to SQL Server. If I do, how can I implement the custom row functions? Is Visual Basic integrated with SQL Server just as it is with Access? Or does T-SQL in SQL Server offer the...
4
13625
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 instead i keep getting a RUN TIME error below: Any ideas.. Runtime Error
7
2923
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="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
5
2557
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 "Enlighten.LinkMad.Businesslogic". In one of my frontend websites I use this type to authenticate a user who is trying to login. The following excerpt is from the web.config of the particular site showing the reference to the custom provider, allowing .Net to do...
8
3902
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 need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
15
6523
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 accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
5
8290
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 RoleProvider. However this only occurs after deployment. On my local machine it works fine. So I created the most basic role provider project I could think of. It is below: Imports System.Web.Security
3
2932
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 Specifically: I have a web service that saves data to a database. This service uses a CommittableTransaction to decide when to Commit or Abort the underlying
0
9680
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, 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...
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
Oralloy
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...
0
10228
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 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...
0
10006
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 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...
0
9052
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, 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...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
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();...
0
5441
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 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.