Active Server Pages Programming (ASP)/ASP .Net deployment Issue - Please help
Expert: Srini Nagarajan - 11/2/2005
QuestionHi,
This is what I want to do: let's say you have a web project web1.csproj within a solution file web.sln. If this project has an ASPX page page1.aspx with code behind page1.aspx.cs. I want to have web.sln, web1.csproj and page1.aspx.cs within one folder and page1.aspx within a separate folder. That way when we deploy to production, we can just copy all the aspx files without copy code behind files, etc.
Your deliverable should be a sample solution with the solution, project and code behind files in a 'Code' folder and the ASPX pages in a 'Web' folder. You should be able to work with the solution file in Visual Studio .NET, and when you compile, the DLLs should be placed in a bin folder within the 'Web' folder.
Could you please help me how to resolve this issue?
Regards,
Thankaraj
AnswerHi
You can not change the location of the code behind file by modifying the CodeBehind to includes the full path. This is the MSDN doc for CodeBehind Attribute:
CodeBehind
Specifies the name of the compiled file that contains the class associated with the page. This attribute is used by the Visual Studio .NET Web Forms designer. It tells the designer where to find the page class so that the designer can create an instance of it for you to work with at design time.
For example, if you create a Web Forms page in Visual Studio called WebForm1, the designer will assign the Codebehind attribute the value of WebForm1.aspx.vb, for Visual Basic, or WebForm1.aspx.cs, for C#. This attribute is not used at run time.
You should not keep aspx and codebehind source file in seprate folders. Both of them are part of a page entity.
What you can do is create a seprate class and call a method so that you can avoid showing the code...
Happy Programming!
-srini