1

when I try to view ASP.NET website in browser I get the full list of files in the website folder. What could be the reason?Is there only one reason or there might be a lot?

xan
  • 7,440
  • 8
  • 43
  • 65
Mikayil Abdullayev
  • 12,117
  • 26
  • 122
  • 206

3 Answers3

2

That could happen if you have not specified a start page for your web application.

Right click on the web page you want to use as the default page and choose "Set as Start Page" whenever you run the web application from Visual Studio, it will open the selected page.


Refer to the following:

Set Default Page in Asp.net

Setting the default page for ASP.NET (Visual Studio) server configuration

Community
  • 1
  • 1
Akram Shahda
  • 14,655
  • 4
  • 45
  • 65
1

EDIT:

If you are launching the site from within Visual Studio, you can set the default page by doing the following:

From this SO question answer

Right click on the web page you want to use as the default page and choose "Set as Start Page" whenever you run the web application from Visual Studio, it will open the selected page.


You need to specify on the server (in IIS) what the default page is, and disable directory listing for the site.

See also:

Setting the default page & disabling directory browsing in ISS / Web.config

Community
  • 1
  • 1
xan
  • 7,440
  • 8
  • 43
  • 65
  • 1
    How do I disable directory listing? – Mikayil Abdullayev Jun 16 '11 at 12:45
  • See the accepted answer in the linked SO question. It's got screen grabs of the IIS configuration pages. – xan Jun 16 '11 at 12:47
  • I get the same thing whatever I do.n the other hand I have a website which is not even added as a default webpage to the IIS. But in Visual Stduio right click on the website and click View in Browser I can easily tart the website. – Mikayil Abdullayev Jun 16 '11 at 13:13
  • If you are launching it directly from Visual Studio then the above solution will not work. Running as you mention from inside VS launches a special development server locally to your machine just to host the site you are working on. This is not configured in IIS at all. This answer relates to a deployed website that is hosted via IIS on a server or local computer. – xan Jun 16 '11 at 13:15
  • What should I do then?I just test the app and then I'll put it in the webserver. – Mikayil Abdullayev Jun 16 '11 at 13:19
  • See my edit to my post, or see Akram Shahda's answer (http://stackoverflow.com/questions/6371957/i-get-website-files-list/6372007#6372007). I don't have VS currently available or I'd find you a screen shot. – xan Jun 16 '11 at 15:27
0

It could be any of the other cases mentioned in the answers OR

IIS by default looks for these files in the directory to serve in the given order if no file is specified.

enter image description here

Perhaps you have not specified a file, and turned on "Directory Listing"

Ranhiru Jude Cooray
  • 19,542
  • 20
  • 83
  • 128