I've set up a new server with Server 2012 R2 and IIS and published an application to a new site. When I run the application in my development environment it shows the .aspx file extension in the URL but when I browse a published instance on the IIS server it removes the .aspx extension.
So somehow it has some sort of URL rewriting enabled out the box - how do I change this as I need it to be consistent with the development version. I installed the URL Rewrite extension to see if somehow any rules were configured but there are no rules defined.
Thanks!
3 Answers
Answers 1
You can configure your web.config file with rewrite rule (examplePage.aspx) like this:
<?xml version="1.0"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="examplePage.aspx Redirect" stopProcessing="true"> <match url="^(.*\/)*examplePage\.aspx$" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" /> </conditions> <action type="Redirect" url="{R:1}" redirectType="Permanent"/> </rule> </rules> </rewrite> </system.webServer> </configuration>
Hope that should work!
Answers 2
I have seen this behavior when creating a certain kind of web project in development. So it could be something installed that interferes. I guess you looked at the web.config already for anything, but if it is not there try the machine.config. Also, take a look in IIS itself, what is installed when you click on the root level (the one above the website).
Answers 3
Have you tried URL Rewrite. Let me know how it goes?
0 comments:
Post a Comment