In my IIS server I have a running website and a web service installed in the same website. The structure is something like this.
MainWebSite
Folder1
Folder2
+ WebService
Now how can I get the path of the Folder1? I want to use something like server.mapPath("Folder1")
Hope I've explained properly.
Using Server.MapPath("Folder1"), you cannot get out of your application root folder. If your "Folder1" is outside root folder of webservice, then you will not be able to access this folder.
Or you may have to explain your problem a bit more.
Related
At work we have an ASP.NET MVC application with a 'Notifications' namespace and accompanying folder.
The problem comes when trying to access /notifications - IIS it tries to serve files out of the notifications folder, instead of invoking the site's default application.
This is not a problem when deploying because the code folders aren't deployed, but during development, IIS sees the folder and tries to serve it.
Does anybody know how to make it just serve the default ASP.NET application for the folder? The closest I got was setting up a virtual folder, but that doesn't work because of the web.config inheritance behavior.
I'm afraid the only way to fix this is to rename either your folder or your controller. They can't be the same name because IIS looks inside of the folder first, and then if the folder does not exist, it goes to the ASP.NET ISAPI which then routes it to your controller.
Reference: http://forums.asp.net/t/1781586.aspx?+Help+Controller+not+getting+hit
Sorry :(
What's the standard or common practice to setup the local path of a website in IIS. Is it c:/inetput/MYWEBSITE or c:/inetpub/wwwroot/MYWEBSITE?
According to this article you can go either way. Should I put my ASP.NET websites in the wwwroot folder?
Thx for your feedback.
There is a wwwroot folder under Intepub. The path may looks like C:\inetpub\wwwroot
But you don't need to put under Intetpub to make your site work. you can put in any other folder also and just map the location to that folder in your website settings under IIS.
It is just personal choice. Both places works. I personally keep it under another folder because sometimes i forget to take backup of my inetpub.
I built Deployment package and feed IIS with that, but when I trying to visit my site, I see only files of root folder like FTP
Whats wrong ?
Do you have a default or index page? Also, in IIS you should disable directory browsing.
I would like to nest asp.net web app within sitecore site, something like this:
<sitecore web root folder>
.
<virtual directory/app folder>
I want to access sitecore site by using following url:
http://<whatever site name>
and I would like to access web app by using following url:
http://<whatever site name>/<whatever virtual directory/app alias>
Is this possible?
I tried it but when I try to access my web app (not sitecore) then web app complains about missing sitecore.
I believe that is because now I have two config files ans when accessing web app iis/asp.net processing first sitecore web.config.
Right, your assumption is correct. See Creating a project in a virtual directory under Sitecore root article for more information about this kind of setup.
You should be able to create a virtual app under a Sitecore root path. Because its an app it will use its own app pool and you can have a web.config for it. I guess the physical files will be OUTSIDE of the Sitecore Website folder but the from a URL you can make the virtual app located anywhere below the Sitecore root.
Im working with asp.net 2.0, and i have a folder into my application path ~/Data/ with some .mdb files.
I would like to protect this folder from external request like http://www.whatever.com/Data/whatever.mdb
But i would need to give any permission to my application, cause im using OleDBConnections agains the ~/Data/ Path.
What could be the best way to protect this folder?
Kind Regards.
Josema.
In IIS manager and remove at least anonymous access if not all access. Your application code can continue to use its contents but HTTP requests can not access it.
If possible in your situation, another option would be to place the mdb files outside of the website. For example, something like this directory structure:
/ MyProject
/ Data
- whatever.mdb
/ www
- Default.aspx
where www is the actual root of your website. That way, users will never be able to access the mdb files from the browser, while you can still use OleDBConnections against the mdb files. To my knowledge this is pretty secure, and this way you can't accidentily forget to disallow access in IIS.
Did you check if it actually is a problem?
I'm using ASP.NET 3.5 here but the default App_Data folder is shielded for downloading. Maybe you should just follow the guidelines and verify.
As for the other answers about moving Data outside your Web folder, that usually won't work when you use a hosting provider.