Why Use App_code Folder
Nov 18, 2010any one explain me why use classes inside app_code folder or which file add inside this folder and what is the logic of that file and how they work?
View 3 Repliesany one explain me why use classes inside app_code folder or which file add inside this folder and what is the logic of that file and how they work?
View 3 RepliesCan any one explain me about App_code folder? AND i want to put some .cs files in that folder. But i coud not see the folder. HOw to add?
View 4 RepliesI've noticed that with some, but not all sites, if I add a class in a .cs file in the App_Code folder, then I can't reference the class anywhere. In some sites, this isn't a problem. If I move the .cs file to the root, then no problem. Anyone able to explain what's going on here? I have a mixture of sites created in VS2010, along with ones that existed before I got it. Don't know if this makes any difference. More to the point, how do I persuade VS2010 (and I suppose IIS ultimately) to allow .cs files in App_Code, as I find this much neater than having class files littered around the root.
View 6 RepliesI have a question. When I create my website using vwd 2008 express, I can not create App_Code folder, actually there's no selection for App_Code folder when I right click on my website(only Theme, App_Resources, App_LocalResources, App_GlobalResources and disabled App_Data).
I try to add new folder and name it App_Code, then put a class in there. But I can reference to it in my code behind.
Is there something wrong with my VWD installment or this is not supported by Express version?
I was trying to create a Dynamic Data Website using VS 2010 RC. An attempt to create an App_Code folder where I would put a LINQ to SQL class, failed. When I selected 'Add ASP.NET Folder' to add the folder, I had options to create only the following folders:
App_GlobalResources
App_LocalResources
App_Data
App_Browsers
Theme
What happened to the App_Code folder?
Using vb.net/asp.net 2005. I have a project that is done with all vb.net, however I want to get some more experience with C#.Net. I am considering creating a new database class to put in the app_code folder.
View 3 RepliesI have an application which contains different modules from different databases, for instance, I have a table called "ITEMS" in each database. When I create the classes for the table ITEMS I wonder how I can differentiate among them.
For instance, for now, I have "ItemDetails.cs" under App_Code folder BUT I need to create another "ItemDetails.cs" class which will reference the table ITEMS from a different database. If I create folder under the App_code the class name still remains the same.
I could add an acronym in front the class to differentiate which database I am working from but that makes the class name too long.
I appear to have hit a brick wall whilst attempting to debug some C# code that resides in the App_Code folder.We have an established ASP.NET solution and I've just been brought onto the team. Unfortunately when I run the code [which successfully debugs (to a certain extent)] it does not step into a *.cs file that exists in the App_Code folder.I've found several posts on the subject, none of which seem relevant to me.
Specifically:
Running Win7 Enterprise 32 bit VS2005 8.0.50727.867 (vsvista.050727-8600) http://forums.asp.net/p/958358/3675792.aspx#3675792 mentioned removing the "+optimize" in the web.config file; this doesn't seem to be relevant to me (<compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/d:TRACE"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>)
The "App_Code" folder doesn't seem to have any peculiar setting associated with it
I also said that debugging works successfully "to a certain extent". I've set up Visual Studio with the C# developer environment. When I hit F11 I would expect the IDE to begin debugging and for the execution point to stop on the very first line of code (this is what it does in all my other projects in VS2003 & VS2008). However, when I hit F11 it acts like F5, running until it either hits a break point or a run-time error. I'm wondering whether this may be related to it not even hitting break-points in code in my App_Code folder?
at vs2008 i could set App_Code folder, but at vs2010 i can not do it, that's why i put my dataset's and class' to App_Data folder. Either I do not know even App_Data folder is secure?
View 4 RepliesI 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 5 RepliesI've searched but not found much that helps, could be using wrong search terms.Anyway, currently using Visual Studio 2005 and VB, but just got Visual Studio 2010 and trying to use C# and am having problems using classes, I think I'm missing something simple here.
In both 2005 & 2010 I create a new website and a Default.aspx, in 2005 using VB, C# in 2010.
Right-click the project -> Add New Item -> Class, and leave it as Class1.vb/Class1.cs
Both 2005 & 2010 prompt to place it in the App_Code folder, so choose yes.
Here are the class files, I've not changed anything apart from create a very simple function:
Class1.vb code: [Code]....
Class1.cs code: [Code]....
In my VB project Default.aspx.vb: [Code]....
No errors, and debugging shows that a = "hello"
My Default.aspx.cs: [Code]....
This gives an error:Error 1 The name 'tester' does not exist in the current context D:Visual Studio 2010WebSite11Default.aspx.cs
How do I reference the tester function within Class1 in my C# project?
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.
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 RepliesI 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 RepliesWe have a website with a huge amount of Cached objects stored in static variables within App_Code. Whenever we push an App_Code change to our production webservers it recycles the IIS pool and flushes the cache. It does not flush the cache however when we push out changes to .aspx and .aspx.cs files.
I need to have a bunch of classes that will be updated several times a day to be able to be referenced in App_Code. I would like either a section of my App_Code which I can update several times a day without cycling IIS and flushing my cache, or the ability to reference classes outside of App_Code from within App_Code.
I am a developer who up until now only used WAP assemblies. Is that old and outdated nowadays? For example I have found a really great sample of google map API I'l like to use but my project is in VB.NET and the sample is using code in App_Code folder in C# so I cannot mix and integrate in a easy way. Do I have to convert the C# code into VB.Net to make it work or is there a shortcut when finding sample code in App_Code folder in the wrong code language?
View 1 Repliesi 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)
{
}
}
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 RepliesI 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?
My problem is that the intellisense is not enabled within the App_Code folder, so to twick this problem I initially create a separate folder where I develop my classes then I move them to the App_Code but, but I'm convinced that this is not the right practice so how to configure visual studio 2008 to enable intellisense at the App_Code folder
View 4 Repliesi am making an application in which i have stored connection string in security.cs file under app_code folder...all is my application is going well except update panel of gridview using sql datasouce..i dont know what to write in connection string .. i mean i have connection string in class file.. so what to write in aspx page so that it will get the connection string from app_code
[Code]....
I create a user control named ExampleControl and add <%@ Register src="ExampleControl.ascx" tagname="ExampleControl" tagprefix="uc1" %> to aa.aspx file So I can use ExampleControl cw = Panel1.FindControl("ExampleControl1") as ExampleControl in the file aa.aspx.cs
Now I hope to use ExampleControl cw = Panel1.FindControl("ExampleControl1") as ExampleControl in a .CS file located App_Code folder, but I get the following error, how can I do?
Error 4 The type or namespace name 'ExampleControl' could not be found (are you missing a using directive or an assembly reference?)
Do we have App_Code in asp.net 1.1 ?
View 4 RepliesI am doing a Web Site in Visual Studio 2010. Actually I'm working on only one module of this page. Module is meant as a subdirectory and all my "module" files must be in this directory. And here comes the problem. I can't use DataSet because i placed it in my subdirectory and not app_code directory.How can I solve this problem? I was thinking about adding some sort of refernce to Web.config but I don't know how.
View 1 RepliesI want to create a WCF Service for use on my ASP.Net website (not project) that either has no codebehind file, which was is an option for a traditional asmx style service but doesn't appear to be for wcf services, or which stores it's code in a separate code project and is just exposed by the svc file.I tried just moving the code file from app_code into my separate project but couldn't figure out how to link them, as removing the codebehind attribute from the svc file immediately throws an error.
View 2 Replies