I am currently putting a new version of my site online. I would like to retain the old site (for purposes of read only access) and have been directed to place it within a subfolder inside the directory where the site use to live. e.g.
www.example.com needs to be moved to www.example.com/old and the new site needs to be moved to www.example.com
Unfortunately I get the classic ASP.NET error when attempting to piggy back sites that each have their own web config.
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.
How can I compeletly seperate off the new site and access it via. www.example.com/old without ASP.NET trying to trickle down through my directories and find the main sites web.config?
Thanks!
Giving the site its own AppPool should work.
You can do this by creating an AppPool and then on the virtual directory in IIS setting the app pool to your new one in the properties.
Make sure that the virtual directory is an application and not just a virtual directory.
You may try the following setting in the site contained in the virtual dir:
<location inheritInChildApplications="false">
Rick Strahl has the same problem and describes his experiences on his blog.
Didn't try it out myself, but found other blog articles which use it successfully with IIS6.
I've tried both creating a new App Pool on the site. That's didn't work -- same errors. I also added the inheritChildApplications attribute directive in my web.config. That didn't work either. The only way I have been able to achieve what I needed was to add a new subdomain in an entirely new folder and put a redirect to it in my www.example.com/old page to old.example.com.
It's not what I was looking to do, but it solved the issue.
Related
Hi I am creating an application where user wants to create and upload multiple websites inside asp .net website.
like
www.mywebsite.com/Websites/Website1
www.mywebsite.com/Websites/Website2
www.mywebsite.com/Websites/Website3
www.mywebsite.com/Websites/Website4
If I upload static website(No database connectivity) to Website1,Website2,Website3 folder it is working fine but If upload website have database in App_Data folder and connection string in web.config folder it is giving me error like : It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Does anyone knows how to solve this issue???
Thanks.
For this Just add virtual directory and put web.config and aspnet_client in that folder and then browse virtual directory..
Thanks all for your suggestions and comments... Few more requirements added to project and goal changed... Now How I am doing (Thought it would be helpful for someone else):
1) Now I am using single Master page for my main website and for multiple websites.
2) Now using single web.config for all the websites(main as well as sub-websites). Because as I have mentioned in my question... static websites are working fine but only problem in database driven websites.
I am not sure that this is the best practice(Who cares when you have no choice :p) but .. It has solved my problem
Last but not Least Thanks #Douglas Thomas and #Shirish ... I have tried this convert to application method on my local IIS and it worked perfectly but now as I have accomplished by other way ... I do not need to contact hosting company [ Some times they made me Angry ] every single time I upload new sub website.
I have a website that was building without any issue on multiple servers.
But, when I copy/move it on the same machine from one folder to another folder: I started getting the error
The Virtual Path Maps To Another Application Which Is Not Allowed.
What am I doing wrong?
The source of this problem is that when one copies an ASP.NET Web Site to a new folder -- the properties setting associated with the solution "Virtual Path" is set to the folder name and not the root. The solution is to change the Virtual Path setting from the folder name to "/".
This can be found by right click the project and opening the properties dialog: Solution->Properties->Virtual Path-> Change to "/"
This isn't why your error happened but it may be useful to someone researching the problem who ends up here.
If your web app is running as an application within another IIS site (set via the IIS administration tool) and is attempting to reach resources of the other site by means such as HttpResponse.Redirect, make sure the project isn't set to use a separate IIS in Visual Studio. If it is, it may be firing up inside a different IIS than the rest of the site.
Additional check: Missing global.asax also causes the same error.
If you are creating a new HttpContext and calling any external
service, it also causes the same error.
Key is you should not create new HttpContext, change the existing
context to your needs.
I was wondering if it is possible to run an aspx.net website in a sub folder if it has it's own web.config with forms auth and is using a role mananger?
I've done this for nested applications recently. Its not too difficult.
In addition to having access the same data store for credential and role data, you need to:
make sure the the machineKeys are the same for both web applications
configure loginUrl's to resolve to the same absolute path
if you're using cookies you need to make sure that the domain is set to a value available to both web applications
also for cookies, if your web applications are nested at diferent levels in a domain make sure that the path attribute is set to "/"
See this blog post for more detail on getting forms authentication working.
Another issue particular to nested applications is that by default your nested web.config will inherit settings from the parent app's web.config. This means that you may need to strip out some items in the child config that are in the parent config, and remove items that are currently in the child app config but would already be present in the parent config. See this for more detail.
Only if you setup this sub directory as different asp.net application from iis
I think there won't be any problems if you use Virtual Directory. Look here for more info:
http://msdn.microsoft.com/en-us/library/zwk103ab(v=vs.80).aspx
http://www.dotnetspider.com/tutorials/AspNet-Tutorial-86.aspx
Is this what you were looking for?
Authentication can only be set in config for all applications, or root folder of web application. Same for setting session. You can use sub folder. But it has to be its own application , so basically it doesn't make a ton of sense to have it as subfolder of another application.
Is there a way to configure the default directory in web.config?
My Default.aspx file is not in the root folder but in /Public/Default.aspx.
I found this post : Set Default Page in Asp.net but it does't work, probably because it's only to configure the default page and not the default directory...
You'll want to configure this in IIS.
You have your website already setup, and all you need to do is add an "Application" within that website.
Add Application...
You can also create a Virtual Directory which would give a similar result. Unfortunately you will still be navigating to http://example.com/public/
My question to you is, what is in the wwwroot directory? Is there a different website? Why not launch two websites within IIS?
Here's more information C/O #waqas
I have a asp.net website in the IIS which is available on internet as www.xyz.com now I have been asked to prepare another website which will be accessed via www.xyz.com/abc.
For this, do I need to create a virtual directory under the website folder XYZ in IIS? or is there any other way to achieve this.
You need to make the subdirectory an IIS application.
Keep in mind that inner apps like yours will be inheriting configurations from the top-most web configuration, so be careful clearing those settings you don't want in the child applications.
Yes a virtual directory will work, however note that if abc is a full-blown app you will have to add it as an application not as a virtual directory