This has probably been asked before but I haven't so far hit on the correct search terms.
I'm using IIS8 I have a file called Index.cshtml which contains my page logic - retrieving page content from database.
So, a URL of www.mysite.com/Index/mypage works correctly usng mypage' as a parameter. However, I'm trying to create a rewrite rule in web.config so that I can have the URLs as www.mysite.com/mypage etc.
Also, I want the root www.mysite.com/ to rewrite to www.mysite.com/Index/home
I've tried many things, so far not working - either I send it into a loop of adding many /Index/Index/index... or, just page not found.
Many thanks for any help
OK, the answer was to use routing instead, reference http://www.mikesdotnetting.com/article/187/more-flexible-routing-for-asp-net-web-pages
adding the following into my _AppStart.cshtml
RouteTable.Routes.Ignore("sitemap.xml"); RouteTable.Routes.MapWebPageRoute("{cat}/{article}/{tag}/{page}", "~/Index.cshtml", new { cat = "", article = "", tag = "", page = "" });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.