8

So I have a website running on a discount asp.net account, and I put an asp.net mvc app in a subdirectory. If my url is 'www.website.com' and my app is in directory 'sample', then 'www.website.com/sample' will execute the mvc app.

My problem is that I want the app to be shown when you go to 'www.website.com' not just 'www.website.com/sample'. I have access to the IIS Manager, and I'm sure there are many ways to do this.

What's the best way to do this?

Mark Rogers
  • 279
  • 1
  • 4
  • 14

4 Answers4

8

You need to configure HTTP Redirection on the web site. Make sure that the HTTP Redirection role service of the Web Server role is installed. Once that's done you can select your site in IIS Manager and double click the HTTP Redirect icon in the IIS area of the features view to configure redirection. (Sounds complicated, huh) - ;)

joeqwerty
  • 108,377
  • 6
  • 80
  • 171
3

Just set

<system.webServer>
  <defaultDocument enabled="true">
    <files> 
      <clear />
      <add value="Candidate/Login.aspx" />
    </files>
  </defaultDocument>
</system.webServer> 

in Web.config file and put all files not with in a subfolder so that user can type Url only instead of Url/subfolder....

Here clear is the main thing to be done which will clear all other default docs with in IIS ...

Alexander
  • 31
  • 1
  • Always bugged me this. You'd think simply specifying a default doc for the subfolder would be picked up if a subfolder was specified as a deep link. Alas not. Nice one. – Carl Hine May 07 '20 at 11:14
0

If I am not mistaking, you can just change the path for the website (not the virtual directory), so that the website points directly to the root folder.

In general, lets assume your website follows the following heirarchy:

d:\Root\Sample

So, if you point the website to D:\Root, then you will have a folder named Sample listed as a folder under your website. If you make it to point d:\Root\Sample, then it should be displaying the inner files/folders of your sample folder.

I am unsure if you want to change the settings for your default website. If this is the only website you are going to host, then you might as well make it. Your IIS default folder will no longer be c:\inetpub\wwwroot - which usually has most of the configurations done beforehand to let any webpage placed here such as handling the access permissions.

Lucas Kauffman
  • 16,818
  • 9
  • 57
  • 92
0

Unless you have other subdirectories that need to be relative to the webroot, you should be able to simply point the root of the website (either a defined website for that host header, or the default site) to the sample directory.

Ben Doom
  • 684
  • 3
  • 6