I have a ASP.NET Web Site using ServiceStack, The site has index.html page which is supposed to be the default page.
When I run it under IIS Express and the application is at the site root, it works OK.
However when I run it under IIS and provide virtual dir name without trailing slash, the application does not work since Web Server returns directly page content instead of HTTP 302 with redirection to URL with / at the end and relative paths in the page resolved incorrectly (on the web server root level instead of app virt dir).
This works fine without ServiceStack with pure ASP.NET
With SS 4.038 I managed to bypass this using DefaultRedirectPath = “/index.html”, however after upgrade to 4.0.50 it does not work anymore (I also installed ServiceStack.Razor, but I do not think it is relevant).
I want to use it as default document, but it should not be returned for request http://sever/dir
Such request should return HTTP 302 with redirection URL http://sever/dir/ and that URL should return the document.
As I said earlier it’s not ServiceStack that handles auto directory redirects for ASP.NET websites, its specific to the ASP.NET host.
The code I’ve provided is how you tell ServiceStack it should add the overhead of checking every request. But if the ASP.NET host already does this you don’t want to add the overhead of checking every request again - which is why it’s opt-in.
would solve this issue, but here I have another problem:
I tried to add ServiceStack.Razor and renamed my page index.html to index.cshtml. Now it works under IISExpress in root dir, but fails under non-root Web directory on redirecting the URL to http://localhost/index. I read that this is “Pretty urls by default” feature of Razor, but how I get rid of it? This redirected naturally fails with 404, so the page is not dispalyed.