When I set up a new site in WebMatrix, the default/home page is default.cshtml. How do I change this to
index.html?
(In 'Settings' for the site, there's a 'Manage Default Pages' option, but default.cshtml is not listed, and promoting index.html to the head of the list doesn't produce the change I need.)
If you have a default.cshtml that is always the default start page, even if it´s not listed in the list with default pages under Settings. I guess it´s because how the routing works in ASP.NET Web Pages.
If you want a default.html as start page, you need to add it to the list with default pages, and remove the default.cshtml if you have that.
Mikael Söderström
http://weblogs.asp.net/mikaelsoderstrom
http://www.twitter.com/vimpyboy
Marked as answer by Mikesdotnetting on Jul 10, 2010 02:07 PM
Brilliant! Thanks so much, Mikael, for your prompt and helpful reply. That's exactly what I needed to do - simply remove default.cshtml, then the Default Pages priority list in Settings is activated, as expected.
From what I understand, both Default.cshtml and Index.cshtml (obviously .vbhtml too) are considered default landing pages. Since you don't need to specify an extension in the url to have the asp router grab the correct files, you can just make an Index.cshtml
file and navigate to http://mysite.com/Index
I need to give a bit more background to my original question.
The site in question is a legacy IIS site with a number of ASP (pre .NET) pages, including the homepage - which is actually index.asp (rather than index.html). I now want to use WebMatrix/IISExpress to maintain a local copy of that site - which means that
I want the ASP router not to hunt for any .cshtml/.vbhtml homepage but instead immediately load the (legacy) index.asp.
Velojet
0 Points
3 Posts
How to change default page from default.cshtml?
Jul 08, 2010 11:57 PM|LINK
When I set up a new site in WebMatrix, the default/home page is default.cshtml. How do I change this to index.html?
(In 'Settings' for the site, there's a 'Manage Default Pages' option, but default.cshtml is not listed, and promoting index.html to the head of the list doesn't produce the change I need.)
Thanks!
John V
Vimpyboy
Contributor
3212 Points
651 Posts
MVP
Re: How to change default page from default.cshtml?
Jul 09, 2010 07:30 AM|LINK
Hi John,
If you have a default.cshtml that is always the default start page, even if it´s not listed in the list with default pages under Settings. I guess it´s because how the routing works in ASP.NET Web Pages.
If you want a default.html as start page, you need to add it to the list with default pages, and remove the default.cshtml if you have that.
http://weblogs.asp.net/mikaelsoderstrom
http://www.twitter.com/vimpyboy
Velojet
0 Points
3 Posts
Re: How to change default page from default.cshtml?
Jul 09, 2010 08:12 AM|LINK
Brilliant! Thanks so much, Mikael, for your prompt and helpful reply. That's exactly what I needed to do - simply remove default.cshtml, then the Default Pages priority list in Settings is activated, as expected.
Cheers
John V
TheSavior
Member
22 Points
6 Posts
Re: How to change default page from default.cshtml?
Jul 11, 2010 04:34 AM|LINK
From what I understand, both Default.cshtml and Index.cshtml (obviously .vbhtml too) are considered default landing pages. Since you don't need to specify an extension in the url to have the asp router grab the correct files, you can just make an Index.cshtml file and navigate to http://mysite.com/Index
Velojet
0 Points
3 Posts
Re: How to change default page from default.cshtml?
Jul 11, 2010 07:20 AM|LINK
Thanks for your interest, TheSavior.
I need to give a bit more background to my original question.
The site in question is a legacy IIS site with a number of ASP (pre .NET) pages, including the homepage - which is actually index.asp (rather than index.html). I now want to use WebMatrix/IISExpress to maintain a local copy of that site - which means that I want the ASP router not to hunt for any .cshtml/.vbhtml homepage but instead immediately load the (legacy) index.asp.
John V