How to hide directory list in ASP.NET 3.5? - asp.net

I have a ASP.NET 3.5 web site, which is password protected (form authentication). But yesterday I found I was able to browse the list of directories (which is unexpected).
I searched the web, one article said we need to config it in IIS. But I'm a developer and I'm working on my local machine (no IIS installed).
My question is: are there any way to hide them other than IIS configuration? like set web.config?

This must be configured in your webserver - you cannot handle this in the website itself. Since you are working locally it shouldn't matter that the root directory is browsable. If you need to be able to control the site in this way you really ought to set up a webserver.

if you don't have IIS, you're likely working on your local ASP.NET development server (called Cassini possibly?), in which it is only available locally, so no security worries there.
When you deploy your app, you will likely be on an IIS server, so the configuration will be available

Directory browsing in IIS is controlled in the virtual directory/site configuration.
When you deploy your application to a real server you can configure directory browsing there.
Directory browsing on your local machine shouldn't matter, but this may work for you.
In IIS6: http://blog.crowe.co.nz/archive/2006/03/18/603.aspx
In IIS7: http://technet.microsoft.com/en-us/library/cc731109(WS.10).aspx

In IIS - Website properties, Home Directory tab, untick Directory browsing.
In Cassini (the ASP.NET development server) I don't think it can be turned off. But the server only runs while your debugging.

Related

HTTP Error 403.14 - The Web server is configured to not list the contents of this directory. in .NET core 3.1

I have project which don't have .sln file as well. I am trying to run but facing error.
I am trying to resolve this issue by going into IIS manager. IIS manager don't have list of sites and unable to add site.
Please give me solution.
Thanks
You are most likely using IIS Express while launching the program and that is why you don't see a website in IIS.
I think you want to enable directory browsing, so look here:
How to enable Directory browsing by default on IIS Express
Just a small side note: by careful with directory browsing on public websites as it can be a huge security risk.

SOME WCF calls return site home page

On an IIS6 server, some WCF services return the home page instead of a useful result.
In IIS, wildcard, axd and svc are all registered to aspnet_isapi.dll.
The site user has full permissions to everything.
Interestingly enough, when viewing the site through a local Cassini install, everything works fine.
Suggestions?
2 possible suggestions:
http://blogs.msdn.com/b/wenlong/archive/2006/09/10/748294.aspx may help.
Also, Under IIS Manager, open Web Service Extension and make sure that ASP.NET v2.0.5.0727 is set to Allowed. (or the ASP.NET v4.... one if thats what you're using)
In fact, WCF not running under IIS 6.0 has some helpful hints.

Changing "Project Url" causes ASP.Net Web app to not be debuggable

I have an ASP.NET Web Application project that I am using to host a WCF Data Services (OData) project.
I went and changed the url from:
http://localhost/MyProject
to
http://localhost/v1/MyProject
after I did that I created a Virtual Directory for the new project URL.
Now when I run I get this error:
Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
I clicked help but it was no help (was IIS 6 level instructions, I have IIS 7). I did some googling and it was all fairly generic responses.
How can I get this working again? (Aside from revert to my old Url. Reverting works but I changed it for a very good reason.)
Your virtual directory need to point to the same scr directory you were originally debugging against.
Also, make sure the virtual directory is configured for Windows Authentication, which is required for debugging.
I had to go to my website in IIS and add a folder under it called v1. After I did that it all worked perfectly.

Visual Studio tells me that an operational local IIS URL has not been configured

I am trying to get a web application project working, after we moved from a StarTeam repository to a TFS repository. I have a web site on my local IIS for the project; this web site is up and serving static content when I test it, but when I copy and past the URL to that site into the Local IIS Web server's Project Url in VS 2010, I get a message that the local IIS URL has not been configured. The popup that displays this message offers me the chance to create a new virtual directory, but this fails. Anyway, this is not what I wish to do.
I usually find myself setting things up in IIS and then copying the URL into VS, but I ensure:
IIS has IIS6 management compatibility components installed.
The folder in IIS is the root of a web application.
The app pool for the web app is configured with the correct .NET version.
And to add to Richard's answer:
Ensure the site's binding in IIS is set to "All Unassigned"

Getting 404 with locall IIS 7 served page

My setup:
Vista 64-bit PC (my local PC)
IIS 7 obviously
VS 2008
I setup a new "Application" manually under the IIS default site. It's running.
The application is pointing to the correct directory (where my default.aspx exists)
I've setup this same exact setup on our dev server running Server 2008 and it runs fine
But for me, when I go to http://localhost/MyAppName I get a 404 not found.
I have no clue why.
So since that did not work and still got a 404, then I tried instead changing from using the VS web server to using IIS in my web project properties in the "Web" tab in VS 2008. Then clicked the "Create Virtual Directory" button and it created a new Application in IIS for me. Same thing though. If I go to that address, I get a 404 on my local machine where it's running.
Ok, I had not installed the IIS 6 functionality of IIS in Vista. I did not know it still used legacy features in IIS 7 to run sites locally....I guess. Not sure why but I guess it uses these IIS6 features. Will have to research why it's dependent on this stuff.
Do you have the home directory to look for "default.aspx" as the default page?
A couple things to check:
First, look at your access logs to see exactly what request is getting logged.
Check your IIS config - you may have a default.aspx page, but is IIS configured to use that as one of the default pages? If you go to http://localhost/AppName/default.aspx do you still get a 404?
If you put a static test.html file in the same directory, can you access it?
These should all help determine the cause.

Resources