Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net application default file Index.aspx

how can i make it that when i go to (for example) http://localhost:60288/ it does not show me a directory listing but rather opens the Index.aspx page? This works with http://localhost:60288/Index.aspx but i don't wish to have Index.aspx shown every time.

i also need links like http://localhost:60288/?a=1 to work like http://localhost:60288/Index.aspx?a=1 without the Index.aspx shown.

this used to work when i created a website project in visual studio, but now i'm using application project. how can I set this up?

i want / need this to work for all sub folders as well e.g. http://localhost:60288/SubFolder/ should work as if it was linked to http://localhost:60288/SubFolder/Index.aspx

thnx

edit still did not manage it

like image 497
b0x0rz Avatar asked Nov 15 '09 10:11

b0x0rz


2 Answers

Cassini (the built-in webserver used by Visual Studio) doesn't allow you to configure the Default Document that's used if you don't specify a filename in your URL. The 'Set as Start Page' option isn't the same thing, as you've found, since that only affects which page is first opened when you run the project, and doesn't affect subsequent page-loads.

However, Cassini does have a list of Default Documents - it just isn't configurable, and the list only contains "default.aspx" and "default.htm". The only way you could achieve what you want in Cassini is to rename all your "index.aspx" files to "default.aspx".

like image 100
Chris Avatar answered Oct 19 '22 00:10

Chris


The easiest way for me to do this was to use a mapping. Inside your Web.config, insert the following:

<configuration>                                                                  
    <system.web>                                                                 
        <compilation debug="true" targetFramework="4.0" />                       
        <urlMappings enabled="true">                                             
            <add url="~/" mappedUrl="~/index.aspx" />                
            <add url="~/default.aspx" mappedUrl="~/index.aspx" />                
        </urlMappings>                                                           
    </system.web>                                                                
</configuration>            
like image 45
class Avatar answered Oct 19 '22 00:10

class