Web updating a website, particularly one based on third party products the login page URL may change. This can be an issue as users may have bookmarked the complete login URL.
Configuring a custom 404 error page that send users to the new login page can resolve the issue.
IIS6 and ASP.Net both have different mechanisms for setting 404 custom errors.
1) Create the custom redirection page
Save this file as redirect.html in the web server root (C:\InetPub\WWWRoot)
<html>
<head>
<title>The Ether: Custom Redirect</title>
<META http-equiv="refresh" content="0;URL=https://domain.com/login.aspx">
</head>
<body>
<!-- Pad the file to greater than 512 bytes to bypass the "Show Friendly HTTP Error Messages" -->
<!-- HOW TO: Turn Off the Internet Explorer 5.x and 6.x "Show Friendly HTTP Error Messages" Feature on the Server Side -->
<!-- http://support.microsoft.com/kb/294807 -->
<!--When you access Web pages from Internet Explorer 5.x and Internet Explorer 6.x, the actual text of an HTTP 500 message that is sent to the browser may be masked by an Internet Explorer "friendly" error message. Although you can turn off this feature manually for each client, this article also provides several server-side workarounds to inhibit the display of "friendly" error messages. -->
<!-- Several frequently-seen status codes have "friendly" error messages that Internet Explorer 5.x displays and that effectively mask the actual text message that the server sends. However, these "friendly" error messages are only displayed if the response that is sent to the client is less than a specified threshold. For example, to see the exact text of an HTTP 500 response, the content length must be greater than or equal to 512 bytes. -->
</body>
</html>
2) Configure IIS to use the redirect as the 404 custom error
Either save the above file as C:\WINDOWS\help\iisHelp\common\404b.htm or from IIS Manager:
- Expand Local Computer
- Expand Websites
- Right click on Default Web Site and select Properties from the context menu
- Select the Custom Errors tab
- Select 404 and click Edit
- Enter the URL of the redirect page (C:\InetPub\WWWRoot\redirect.html) and click OK
- Select 404;2 and click Edit
- Enter the URL of the redirect page (C:\InetPub\WWWRoot\redirect.html) and click OK
- Select 404;3 and click Edit
- Enter the URL of the redirect page (C:\InetPub\WWWRoot\redirect.html) and click OK
- Click OK to exit Custom Errors
3) Configure ASP.Net to use the redirect as the 404 custom error
Save this file as web.config in the web server root (C:\InetPub\WWWRoot)
<?xml version="1.0" encoding="utf-8"?>
<!-- A URL starting with a tilde (~), such as ~/redirect.html, indicates that the specified URL is relative to the root path of the application. -->
<configuration>
<system.web>
<customErrors mode="On">
<error statusCode="404" redirect="~/redirect.html" />
</customErrors>
</system.web>
</configuration>