I've created an application and I published it on my server. I would like to set it so when the user navigates to
appName.domainName.com
they would automatically be redirected to
appName.domainName.com/myApplication.aspx
I've set up a Default.htm file in my root directory with a redirection meta tag. However, if I set the page to be my home page, whenever I first open IE, I get a "Interent Explorer cannot display the webpage" message. Once I hit F5 it refreshes and works correctly. Does anyone have a clue as to what could be causing this?
One option would be to configure IIS to use myApplication.aspx as the "default page" when navigating to your application instead of redirecting based on a previous default page.
Using the IIS documentation, you could add this to your web.config
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="myApplication.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Or otherwise use the IIS manager to set the value to your page.
Related
I have a site made in asp.net (vb.net as backend).
This site is locateted http://localhost/TEST.
If I visit any aspx file like http://localhost/TEST/about.aspx i get redirected to login aspx. Login.aspx is set as start page in visual studio.
The problem is that if i visit http://localhost/TEST I come to a directory with a list of all the aspx files.
How do I redirect any user that visit http://localhost/TEST to http://localhost/TEST/login.aspx ??
Your post has some mixed concepts in it. Lets get them organized.
First, VS has a start page. That is the starting page used when you run the web site with or without the debugger. That only matters when you are running the site from VS. Once you deploy to IIS then that no longer has any impact.
What you are asking for is a default page the user is redirected to when they don't explicitly specify a page. You can configure the default page in the web.config like this:
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="About.aspx" />
</files>
</defaultDocument>
</system.webServer>
You don't want to specify Login.aspx as the default page. Specify a home page. If the user has already logged in then they should not be automatically navigated to the login page, you want them to go to some home page.
The login page sounds like it is already configured correctly because you mentioned that when you go to about.aspx it redirect to login.aspx. That is handled in the authentication section of the web.config file. If the user has not been authenticated then it will redirect to the login page.
<authentication mode="Forms">
<forms name="asp.ASPXAUTH" loginUrl="login.aspx" protection="All" path="/"/>
</authentication>
I think the only part you need to change is adding the defaultDocument section to web.config.
In your folder TEST, create a blank webpage called "default.aspx" that redirects visitors to the login page if they are not logged in or the about page if they are logged in.
You can simply use web.config file and disable the directory browsing.
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>
I have a web application which is hosted in iis7 in amazon ec2 instance.The directory structure is like Website>Pages>welcome.aspx.The physical path for the iis site has been set at website level.I have added the default page as pages/welcome.aspx.Now when we are accessing the website the site redirects to the default page but the url remains like abc.com:XXXX rather than abc.com:XXXX/pages/welcome.aspx.Now when someone clicks on links with href like abcd.aspx, a page not found exception is thrown as it is searching for the content in the root directory rather than in the pages directory.
Go to your web.config and add:
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="pages/welcome.aspx" />
</files>
</defaultDocument>
</system.webServer>
From this post.
I deployed my web application to IIS7 and everything works just fine. However, instead of typing the url of my true starting page, I want it to automatically go to www.xxxxxx.com/views/root/default.aspx.
How do I do this?
Just go to web.config file and add following
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Path of your Page" />
</files>
</defaultDocument>
</system.webServer>
On IIS Manager select your page in the Sites tree.
Double click on configuration editor.
Select system.webServer/defaultDocument in the drop-down.
Change the "default.aspx" to the name of your document.
Karan has posted the answer but that didn't work for me. So, I am posting what worked for me. If that didn't work then user can try this
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="myFile.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
On IIS Manager--> Http view--> double click on Default and write the name of your desired startup page, Thats it
For those who are newbie like me, Open IIS, expand your server name, choose sites, click on your website. On new install, it is Default web site. Click it. On the right side you have Default document option. Double click it. You will see default.htm, default.asp, index.htm etc.. to the extreme right click add. Enter the full name of your file(including extension) that you want to set it as default. click ok. Open cmd prompt as admin and reset iis. Remove all files from c:\inetpub\wwwroot folder like iisstart.html, index.html etc.
Note: This will automatically create web.config file in your c:\inetpub\wwwroot folder. I didnt have any web.config files in my inetpub or wwwroot folders. This automatically created one for me.
Next time when you enter http(s)://servername, it opens the default page you set.
If you want to do something like,User enter url "www.xxxxxx.com/views/root/" & default page is displayed then I guess you have to set the default/home/welcome page attribute in IIS. But if user just enters "www.xxxxxx.com" and you still want to forward to your url, then you have write a line of code in the default page to forward to your desired url. This default page should be in root directory of your application, so www.xxxxx.com will load www.xxxx.com/index.html which will redirect the user to your desired url
I was trying do the same of making a particular file my default page, instead of directory structure.
So in IIS server I had to go to Default Document, add the page that I want to make as default and at the same time, go to the Web.config file and update the defaultDocument header with "enabled=true". This worked for me. Hopefully it helps.
I have an ASP.NET web site project, which I'm publishing to IIS on my Win2k8 R2 server. It has a default page called login.aspx. I set that up on the published web site.
Trouble is, every time I publish a new version of the web site, the login.aspx entry gets erased from the "Default Document" settings of the web site in IIS. This is very annoying. How can I publish my web site from Visual Studio without wiping out the default page every time?
Try putting a defaultDocument in your site's web.config:
<system.webServer>
<!-- your other stuff -->
<defaultDocument enabled="true">
<files>
<clear/>
<add value="login.aspx"/>
</files>
</defaultDocument>
</system.webServer>
You are probably using "sub site", and the default document list of the root website is blank.
Try adding default document (even dummy) to the root website and see if it helps.
(Taken from here: http://forums.iis.net/t/1169880.aspx)
when the login.aspx is added to subsite. it's type 'local'. it gives this error.
you should add this page to the servere itself.
click the server and then choose the feature view--> iis--- default document then right click to add your "login.aspx" page.
now you should see this in default document of all your sub sites and it will not be erased in publish or server restart.
this is my personal exceperience
Omar kamel
We have a website developed by ASP.NET+IIS7 and its default document is default.aspx. It works fine. But when we tried to switch the default to index.html, weird things happened.
We have modified web.config as follows:
<defaultDocument>
<files>
<clear />
<add value="index.html" />
</files>
</defaultDocument>
and we have clear everything under C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files``, and restart the worker process. We even changed the name of Default.aspx to dddd.aspx.
But everything stays the same when accessing with http://localhost/<MyAppName>/!
And when we tried to access with http://localhost/<MyAppName>/index.html, it works fine.
Any suggestions would be highly appreciated.
You have to change your IIS Website Settings. The order in which the documents will be served.
You problably have
Default.aspx
Index.html
It should be
Index.html
Default.aspx