Reputation: 91895
I've got an ASP.NET-hosted WCF application. At the moment, it displays a 403.14 - Forbidden: The Web server is configured to not list the contents of this directory.
error.
I'd like to replace this with something friendlier. However, I'd like to display a different page to localhost
than to other visitors. The localhost
page should have a little bit more information about where to look in the documentation for example.
Upvotes: 2
Views: 116
Reputation: 669
try to use the redirectmode RemoteOnly in your webconfig. Then your remote connections will display your custom errorpage, but locally you will recieve the yellow screen of death.
<system.web>
<customErrors defaultRedirect="SiteErrorPage.aspx" mode="RemoteOnly">
</customErrors>
<system.web>
Upvotes: 0
Reputation: 39898
You can add a Default.aspx
to your WCF project. In the code behind you can add the following line in your Page_Load
if (HttpContext.Current.Request.IsLocal)
{
// Show localhost information
// or use Server.Transfer to move to another aspx file.
}
Upvotes: 1
Reputation: 2421
you can do this
bool isLocal = HttpContext.Current.Request.IsLocal;
and then display whatever you want or redirect according to isLocal.
Upvotes: 0