Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:20:13+00:00 2026-06-08T03:20:13+00:00

I want to design a general error page which displays different message by HTTP

  • 0

I want to design a general error page which displays different message by HTTP Status error. Is it possible?

<customErrors mode="RemoteOnly" redirect="GenericErrorPage.htm">

For example, if

 error statusCode="403"

Then displaying

 Access Denied!

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:20:15+00:00Added an answer on June 8, 2026 at 3:20 am

    Yes, it;s possible, try something like:

      <customErrors mode="On">
        <error redirect="~/GenericError.aspx" statusCode="404"/>
      </customErrors>
    

    However keep in mind that if you are hosting your web application in IIS 7, then you would need to define your custom errors as follows:

      <system.webServer>
        <httpErrors existingResponse="Replace" errorMode="Custom">
          <remove statusCode="404"/>
          <error statusCode="404" path="GenericError.aspx" responseMode="Redirect"  />
        </httpErrors>
      </system.webServer>
    

    Edit 1

    If you want to have a generic ASPX error page and display error messages depending on the HTML error status code, you could do the following:

    (I just tested and it works)

    Add the attribute redirectMode="ResponseRewrite" to your customErrors section:

    <customErrors mode="On" defaultRedirect="~/GenericError.aspx" redirectMode="ResponseRewrite" />
    

    In your generic error page (Page_Load event):

        var ex = HttpContext.Current.Server.GetLastError();
        this.lblMessage.Text += "<br/>" + ex.Message + ex.GetType().ToString();
    
        if (ex is HttpException)
        {
            var nex = ex as HttpException;
            this.lblMessage.Text += " " + nex.GetHttpCode().ToString();
    
            switch (nex.GetHttpCode())
            {
                case 404:
                    // do somehting cool
                    break;
                case 503:
                    // do somehting even cooler
                    break;
                default:
                    break;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to design a page in django that has a search bar in
I want to design a c# program which can run program a 3rd exe
Hello guys, I have a general design problem with iPhone application. I want to
I want to build a back end of a general web form which contains
I want design my startup screen with progress bar. But I don't how to
Am working on international project, and want design 3 major tables structure as required
I want to design a webpage login that when click on the login button
We want to design a simple domain specific language for writing test scripts to
I want to design a chat view like BlackBerry messenger (unfortunately new users are
I want to design a login and register layout using android tabs. Image is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.