Hello,
I made a web page using visual studio.
I also made a public class in the app_code folder called 'allvars'
In the main web page durning the page startup, I can refer to public shared
variables by simply saying:
x=allvars.varia ble1
where the allvars class looks like this:
Public Class allvars
Public Shared variable1 As Integer
end class
All seems well in development
But when I copy it to the web site folder (copy all files in the asp.net web
site (app_code folder too)
But when I call it, it gives this error:
Name 'allvars' is not declared.
So in development, it knows where the class is, but in the real web it
doesn't.
How do I solve this problem? I also tried publishing it to the web folder,
and that didn't work either.
I don't care about performance, or precompileing, just want it to work.
Thanks for any help!
Scott 5 3812
probably a namespace problem. when vs compiles the codebehind it passes
default namespaces to the vb compiler (c# doesn't use this feature).
when you let asp.net compiel your project, the namespace is not set.
you should download the deployment project and use it. it will handle
these issues for you, or read the documentation, so you know what to deploy.
also I hope you know that shared variables are shared across all
requests, so be sure to use locks so two requests do not try to change
them at the same time.
-- bruce (sqlwork.com)
Web Search Store wrote:
Hello,
I made a web page using visual studio.
I also made a public class in the app_code folder called 'allvars'
In the main web page durning the page startup, I can refer to public shared
variables by simply saying:
x=allvars.varia ble1
where the allvars class looks like this:
Public Class allvars
Public Shared variable1 As Integer
end class
All seems well in development
But when I copy it to the web site folder (copy all files in the asp.net web
site (app_code folder too)
But when I call it, it gives this error:
Name 'allvars' is not declared.
So in development, it knows where the class is, but in the real web it
doesn't.
How do I solve this problem? I also tried publishing it to the web folder,
and that didn't work either.
I don't care about performance, or precompileing, just want it to work.
Thanks for any help!
Scott
Thank you very much. I'll check into these things.
I don't want users to collide over the variables. I thought each time
someone started the page, it was a whole new set of variables.
You mean if 20 users get on, they will be all changing each other's
variables?
Thanks.
Scott
"bruce barker" <no****@nospam. comwrote in message
news:eL******** ******@TK2MSFTN GP05.phx.gbl...
probably a namespace problem. when vs compiles the codebehind it passes
default namespaces to the vb compiler (c# doesn't use this feature). when
you let asp.net compiel your project, the namespace is not set.
you should download the deployment project and use it. it will handle
these issues for you, or read the documentation, so you know what to
deploy.
also I hope you know that shared variables are shared across all requests,
so be sure to use locks so two requests do not try to change them at the
same time.
-- bruce (sqlwork.com)
Web Search Store wrote:
>Hello,
I made a web page using visual studio.
I also made a public class in the app_code folder called 'allvars'
In the main web page durning the page startup, I can refer to public shared variables by simply saying:
x=allvars.vari able1
where the allvars class looks like this:
Public Class allvars
Public Shared variable1 As Integer
end class All seems well in development But when I copy it to the web site folder (copy all files in the asp.net web site (app_code folder too) But when I call it, it gives this error: Name 'allvars' is not declared.
So in development, it knows where the class is, but in the real web it doesn't. How do I solve this problem? I also tried publishing it to the web folder, and that didn't work either. I don't care about performance, or precompileing, just want it to work. Thanks for any help! Scott
Hi Scott
In the main web page durning the page startup, I can refer to public
shared
^
Be sure that all static / shared variables are on the application scope.
So every value is the same for all users.
--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Hi,
I am also having the same issue.
I have a class in App_Code folder.Everythi ng is fine during development.Whe
I copy it to production server I get an error:
The type or namespace name 'clsClientDetai ls' could not be found (are you
missing a using directive or an assembly reference?)
I tried creating App_Code folder is root and as virtual directory in the
production web server, even that didn't help.
Then created a seperate dll file with all these classes and gave a refernce
to it in the existing project and now it was in Bin directory.But again the
same issue.Why it could't locate the assembly or class.Even i wrapped it
inside a namespace but that couldn't help either.
Can somebody help me.
Thanks in advance,
Zainu
"Peter Bucher [MVP]" wrote:
Hi Scott
In the main web page durning the page startup, I can refer to public
shared
^
Be sure that all static / shared variables are on the application scope.
So every value is the same for all users.
--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
i experienced the same issue with class in the code_app or assemblies in the
bin folder not being able to be referenced, after playing around not even a
basic .aspx file would execute. The solution is to check and remove any
app_offline.htm which often resides in the virtual directory.
info:- http://dotnet.org.za/armand/archive/.../03/38757.aspx
yep! that little file made me fill up my swear jar. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian Henry |
last post by:
I have a project that was upgraded from ASP.NET 1.1 to ASP.NET 2.0. When I
step through the page load even of one of my web forms, it calls a function
in the app_config folder which is under the "SecMsg" namespace inside a
public class, and the function is a shared function. when i step through the
debugger the page load of the form is caught by the debugger when i step to
the next line on the line that calls the function, it never goes to...
|
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 need to add user controls to the page
control container. i.e:
protected override void OnInit(EventArgs e)
{
|
by: Filip De Backer |
last post by:
Hi everyone,
I've created 5 (different) asp.net 2.0 applications.
Each applicationfolder contains an App_Code folder.
Is it possible to set the App_code folder in de root of the website?
Because the purpose of the App_Code is reusable classes, it isn't very
productive to copy the class files to the App_Code folder (only 3 of the 5
applications need the class file).
thanks!
|
by: hummh |
last post by:
Hello out there,
I´m making my first steps with ASP.NET 2.0 and have he following
problem:
I´ve implemented a Web User Control that sits in the root of my
ASP.NET Website. I want to use the Type of the control in a class
that´s under the App_code folder. As with ASP.NET 1.x, I tried to
reference the Control via the using keyword - but that didn´ t work,
because the Web User Control has no namespace (VS.NET didn´t add one).
|
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 "not exist in the current
context".
I thought putting code behind in App_Code folder is the recommendation for
asp.net 2. In order to do so, I just simply remove the codefile attribute in
@page.
Maybe my perception of putting all code in...
| |
by: Howard |
last post by:
I have two websites that basically use the same data access layer. the code
in the app_code folder are identical for these two website. Each has a
different presentation layer (html stuff). It's a lot of work keeping the
two up to date when making changes in the data access layer.
Im wondering if there is a way to let two websites share the same app_code
or something to that effect.
Has anyone done this
Is this even possible? If so how do...
|
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 new item. I expected the code
behind file (Default.aspx.cs) to automatically go under APP_CODE folder, but
it didnt. I tried to drag and drop the code behind file into the APP_CODE
folder. I also changed the page directive to the following:
...
|
by: Rotsey |
last post by:
Hi,
I have a web site being developed with VS2005.
I am upgrading a VS2003 application by copying each page one at a time
and fixing problems. Also I have copied across my class object code
to the App_Code folder.
The problem I am having is in a class in the App_Code folder I refer to a
user
|
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 problem when I right clicked and added the new class to the App_Code folder...so I recreated the class in the root of my application.
Everything compiled properly, ran like a dream.
I figured, to keep organized, I'd move the class into the App_Code...
|
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...
|
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,...
| |
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...
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |