1and1 Help Centre Categories

print article

Place the CodeBehind Files for an ASP.NET Application

In this article you will learn how to determine the proper location for CodeBehind Files in ASP.NET.

Follow the instructions below to place the CodeBehind files in ASP.NET. The location for these files depends upon how your domain is set up.

There are two possibilities:

All your domains are pointing to the Root (/.) and you are redirecting them to different folders using a default.asp Script.
<%EnableSessionState=False

host = Request.ServerVariables("HTTP_HOST")

if host = "test.com" or host = "www.test.com" then
response.redirect("http://domain1.com/domain1/index.htm")

elseif host = "tranquilhome.com" or host = "www.tranquilhome.com" then response.redirect("http://domain2.com/domain2/index.htm")

else
response.redirect("http://domain1.com/error.htm")

end if
%>

With this kind of setup, you can place the CodeBehind files in a "bin" folder. And the "bin" folder can then be placed in the respective folders the domain is pointing to.

For example: The CodeBehind files for domain1.com can be placed in the folder domain1 (/domain1.com/bin).

Please note:
The web.config can go into the respective folders, too.

Your domain is pointing to a folder from the 1&1 Control Panel.

All CodeBehind Files for .NET Applications should be placed in "bin" folder. The "bin" folder should then be placed in the root directory of your server and also the application directory of your domain.

For example: You have a domain named domain-name.com and all the files associated with that domain are in a folder named domain-name. Therefore the path for that folder is: E:\kunden\homepages\XX\dXXXXXXX\domain-name. The path for the root folder is: E:\kunden\homepages\XX\dXXXXXXX\

Place the bin directory in the "domain-name" folder and also the root. Additionally, place the web.config file in the root folder and the application folder.

For additional information, you may want to reference: