I have a website:Website Link with a problem, when it comes to extension less calls. if you try something like: This
I would like the user to go to:
but that is not what happens.
How can i change that?
Atm. i have this in my web.config
:
<customErrors mode="On" defaultRedirect="/Error.aspx" redirectMode="ResponseRewrite">
<error statusCode="400" redirect="/Error.aspx?code=400" />
<error statusCode="403" redirect="/Error.aspx?code=403" />
<error statusCode="404" redirect="/Error.aspx?code=404" />
<error statusCode="500" redirect="/Error.aspx?code=500" />
</customErrors>
and
<system.webServer>
<httpErrors existingResponse="PassThrough" />
<modules runAllManagedModulesForAllRequests="true">
Some rewriting sends Error.aspx
to "/findes-ikke"
After som more testing, with no luck, this is my entire web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation batch="false" targetFramework="4.7.1" debug="true" />
<customErrors mode="On" defaultRedirect="/Error.aspx" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="/Error.aspx?code=404" />
</customErrors>
</system.web>
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404"/>
<error statusCode="404" path="/findes-ikke?code=404" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
</configuration>
You can try the following:
change the web.config line to:
<error statusCode="404" redirect="/findes-ikke?code=404" />
You can also try to add following in web.config to redirect all http requests:
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404"/>
<error statusCode="404" path="/findes-ikke?code=404" responseMode="ExecuteURL"/>
</httpErrors>
You can also do this to redirect all error requests. Make this change in the code you have given above:
<customErrors mode="On" defaultRedirect="/findes-ikke?code=404" redirectMode="ResponseRewrite">