Modifications in default document won't take effect - asp.net

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

Related

My subdomain .NET project is not directing to my startup file

My wedding is coming up and I've printed 100 invites directing my guests to http://wedding.mydomain.com. Similar to a stand-alone project, I've set my startup page to my Default.aspx page as demonstrated here: http://blogs.msdn.com/b/zainnab/archive/2010/12/16/set-as-start-page-vstipproj0027.aspx.
However, when directed toward http://wedding.mydomain.com, I get a 'Maintenance' page. I have to manually go to http://wedding.mydomain.com/Default.aspx, to get the desired project.
Sounds like you might need to set the default document.
If you have an using IIS7(+) windows hosting you can set the default document in your web.config like
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="default.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
If you are using the Plesk interface refer to this article: https://support.godaddy.com/help/article/6853/changing-your-windows-hosting-accounts-default-file

Default page at end of url

my test site suddenly went weird after I added condition for letting %20 at end of urls pass thru, example:
localhost/MySite/1234%20
redirects to
localhost/MySite/1234
it was okay, when I was testing it in my local pc, but upon deployment for testing, it redirects to this link
localhost/MySite/1234/default.html
what do you think may cause this problem? also, "default.html" is my default page when accessing localhost/MySite
it goes to localhost/MySite/default.html
Are you using iis? it seems your webserver configuration in your local machine different from your deploying server. Maybe your testing server uses "default page" rule to default.html, something like this
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Pages/default.html" />
</files>
</defaultDocument>
</system.webServer>
on your web.config.
try here http://www.iis.net/configreference/system.webserver/defaultdocument

Setting default page in iis7

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.

IE does not navigate to default.htm

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.

How do I set the default page of my application in IIS7?

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.

Resources