Can't Use Class In .cs File Under App_code?
Apr 10, 2010
I've developed a class and it is put in a .cs file under the app_code folder. The class is a public one and there is no namespace specifically defined for this class in the file.of my webpages uses this class. It works ok on my local machine. However after I uploaded the page to the web server and then try to display the page through internet, the sever told me the class name can not be found.
View 3 Replies
Similar Messages:
Jul 1, 2010
While working on my FTP server, I am trying to access a class within my App_Code, but it is not working.When writing, the class is accessible/usable in the code like shown in picture. I get no build errors.But when I run it in the browser, I get an error stating that it cannot find my class.I've looked around some other posts on the forum, like using namespace, but it didn't work.
View 8 Replies
Jul 1, 2010
this is relatively simple, but how would i go about retrieving the windows login name from the class file in the App_Code folder. I have set up my website to run windows authentication, and can use httpcontext to get windows login name from code beihind, but without passing this to the class everytime, is it possible to get the login name from within the class?
View 2 Replies
Jan 23, 2011
Since App_Code doenst exist as an ASP.NET Folder, I manually added App_Code as a regular folder, then within that I placed technologydescriptor.cs. Although it now has the appearance of an ASP.NET Folder.But for some reason my code doesnt recognize this class if its w/in the App_Code folder. This is picked up if it is not within that folder- why?Error: "The type or namespace name could not be found, are you missing a using directive or assembly reference"
[Code]....
View 4 Replies
Nov 14, 2010
I am relatively new to asp.net environment.Recently working on a project, i discovered a problemi.e. I had to add using system.io to all file functions in any page. same for using sql functionsi.e. any method for that namespace had to be used in full like By adding the following section in web.config , ALL my pages automatically have access to that namespace
<namespaces>
<add namespace="System.Data"/>
<add namespace="System.Data.SqlClient"/>
<add namespace= "MySql.Data.MySqlClient"/>
<add namespace="System.IO"/>
</namespaces>
[code]...
View 2 Replies
May 23, 2010
Best way to describe my issue with vs 2010.create a new website. create the App_Code folder. create a new class in the folder. put the line "x" in the class declaration. hit compile. And the website will compile with no errors. It's not "seeing" this new class as being part of the project best I can tell.
View 1 Replies
Nov 15, 2010
Is there any way to list all the class in my ASP.Net application(Including class in App_Code and Partial Class(aspx pages and asmx user controls)
View 3 Replies
Jan 8, 2010
If a static class is put in App_Code, does that imply only one instance will be created, shared by different http requests?Or each request still brings one request?
View 3 Replies
Oct 19, 2010
I have a logging class that, well, logs things. I would like to add the ability to automatically have the current page be logged with the messages. Is there a way to get the information I'm looking for?
View 4 Replies
Jun 25, 2010
I am using VS2010 and am creating an ASP.Net application.I have declared a class called "Calculator" in a class file called "Calculator.cs" in the App_Code folder.I have a form called "CalcDemo.aspx" with a code behind file. I try and use the "Calculator" class but intellisense can't see it. I thought App_Code is the common code repository for any classes I define and should be visible to all ASPX code behind files
The namespaces are the same like Webapp1.xxxx
View 2 Replies
Apr 23, 2010
Is there anyway to actually have a class-file placed in any custom directory and still be able to compile it with the application?
View 4 Replies
Feb 8, 2010
Is that possible to get access to Session, Cache, Server.MapPath() from a class in App_code?
View 1 Replies
Dec 6, 2010
I'm trying to set up a smart way to handle email in my ASP.NET Web Application Project. I created a class in my App_Code folder named "MailHelper.cs" but am having trouble invoking it in the code-behind pages. Can someone please correct me on the correct way to do this?Here's the Mail.Helper.cs file in App_Code:
[Code]....
How do I invoke this when I'm ready to fire off a message? Let's say I have a Submit_Click event and want an email to be generated:
[Code]....
View 3 Replies
Jan 31, 2010
I have a PlannerShiftView user control in the root folder of my ASP.NET web site. In my App_Code folder, I have a ShiftViewTemplate class that needs to instantiate a PlannerShiftView (for a TemplateField in a GridView). The problem is, the following code doesn't compile because the PlannerShiftView type is not available in what I deem to be the App_Code 'phantom namespace'.
Please can somebody explain to be what is happening here, as well as what to do. I know I can just move the ShiftViewTemplate out of App_Code, going against convention and without explantion, but that is something of a hollow victory.
View 1 Replies
May 5, 2010
I guess I might be missing something easy (or not) here. I have a class in App_Code which do some validations over Session and Request.Url, till here it's working fine. But then I need to get the actual page title. I know it's simple to get it in the page's code behind, but could I get it in a separate class like it is on my scenario?
View 8 Replies
Feb 25, 2010
I have a single project. and I have two folder in it. In the 1st folder I have a class named Class1 and in the 2nd folder I have a class named Class2. Can anyone tell me how I can access members of Class1 in Class2. I have tried by adding namespace in Class1 and Using that namespace in Class2. But it is giving error. It is easy to access classes or their members from App_Code folder. I don't want to put my classes in app_code folder.
View 3 Replies
Apr 6, 2010
I have some problem in app_code. I created one class name as class1 in side app_code.... Now I have a grid view with lots of textboxes inside it(itemtemplete). I call class1 to fill the all the values in my database with get set properties..... it working awesome on local. but problem is that after published it is not working.... I mean class1 is not called after publishing.... And app_code folder also not appearing at published folder.
View 5 Replies
Aug 23, 2010
i want to do some thing like this in in Class inside(App_code) folder i want to know how to do it with
Correct Syntax :
public static void GetViewStateValue(int StudentID,ViewState MyViewState)
{
if(MyViewState["Name"]!=null)
{
}
}
View 7 Replies
Mar 8, 2011
Or any class that's not X.aspx.vb. I've imported the Globalization, Threading, Threading.Thread, and UI.Page namespaces. But it won't come up in Intellisense and it gives error lines in my code. Is there a way to access use the GetLocalResource("Y") method in other classes?
View 3 Replies
Dec 20, 2010
We have an asp.net website running on IIS 6 Windows 2003. When ever we upload a class file to the App_Code folder our whole site goes down temporarily until, what I assume, compilation is complete. Has anyone else experienced this? Any other file we upload it does not do this only our class files.
View 1 Replies
Nov 18, 2010
I have created a simple ASP.NET Website in Visual Studio 2008. I have a static C# class (lets call it someClass) contained in a separate file in the App_Code folder. I call a method from that class in my page's code behind like so:
someVar = someClass.someMethod(someParam);
This compiles correctly in VS 2008 but when I move it over to my IIS server, I get the following error (CS0103): 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: CS0103: The name 'someClass' does not exist in the current context I have created a virtual directory for this website enabling 'Read', 'Run scripts (such ASP)', and 'Execute (such as ISAPI applications or CGI)'. I am not currently utilizing namespaces (as I thought I would not need to and I'm not sure how to use them properly). What am I doing wrong?
View 1 Replies
Apr 14, 2010
External.dll
IMyClass NewCreated = (IMyClass)Activator.CreateInstance(Namespace.MyClass).UnWrap();
Asp.Net WebSite
App_Code
Namespace.MyClass.cs
Bin
External.dll
Is that even posible? I have tried, a lot of posible combinations, like:
Assembly.GetCallingAssembly().CreateInstance("Namespace.MyClass")
Activator.CreateInstance(AppDomain.CurrentDomain,"Namespace","Namespace.MyClass")
Assembly.GetExecutingAssembly().CreateInstance("Namespace.MyClass")
View 1 Replies
Nov 18, 2010
I've created a new class in App_Code
namespace Site {
public class MyClass {
public MyClass() {
}
}
}
this is my Global.asax.cs
[code]....
The error is in: MyClass myClass = new MyClass();
The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)
View 1 Replies
Jun 2, 2010
I have a MasterPage project which is a class library project (it includes themes, style sheets, menus etc) and all applications use them.
I am using the BasePage concept for dynamically adding title,meta tags and descriptions. This BasePage Class inherits system.UI.Page and the aspx pages in the project inherits the BasePage class.
Now i need to move this BasePage class from my application to the Master Page Project so that all the projects/applications can reuse the same code.
I tried add the basepage.cs in the App_code folder and tried calling it in the page directive like below
<%@
Page
Language="C#"
MasterPageFile="~/Master/Layout/MasterPage.master"
AutoEventWireup="true"
CodeBehind="xxxx.aspx.cs"
CodeFile="xxxx.aspx.cs"
Inherits="xxxx"
ValidateRequest="false"
EnableEventValidation="false"
ViewStateEncryptionMode="Never"
CodeFileBaseClass="~/Master/App_Code/BasePage<Page>"
Title="Title"
Meta_Keywords="xxxx,yyyy,zzzz"
Meta_Description="This is a test" %>
But i am getting error
Could not load type '~/Master/App_Code/BasePage<Page>'.
This was working fine till the BasePage class was inside the application. But once i moved it out of the project and added it to the master page project i getting this error.
View 3 Replies
Jun 8, 2010
just a quick question -i cant get my class in App_Code to work in my code behind page for simple .net page, some light what doing wrong?
[Code]....
View 7 Replies