Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. StatusCode not working properly.

StatusCode not working properly.

Scheduled Pinned Locked Moved ASP.NET
helpsysadmindebuggingtutorialquestion
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kasic Slobodan
    wrote on last edited by
    #1

    Me again. I have a strange problem with StatusCode. I want to simulate a '500 Internal Server Error' by setting Response.StatusCode equal to 500, but it doesn't seem to work. I've turned on trace, page renders properly, but the Status code in trace is 500. I even turned on custom errors in web.config, but Response.Status = 500 doesn't make ASP to redirect to a page inside web.config, but when I misspelled a URL, ASP redirects me to a 404 error page. Can anyone tell me how to simulate page status like that error really happened? Thank you so much!

    P 1 Reply Last reply
    0
    • K Kasic Slobodan

      Me again. I have a strange problem with StatusCode. I want to simulate a '500 Internal Server Error' by setting Response.StatusCode equal to 500, but it doesn't seem to work. I've turned on trace, page renders properly, but the Status code in trace is 500. I even turned on custom errors in web.config, but Response.Status = 500 doesn't make ASP to redirect to a page inside web.config, but when I misspelled a URL, ASP redirects me to a 404 error page. Can anyone tell me how to simulate page status like that error really happened? Thank you so much!

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      It's early in the morning here, so I apologise if this seems a bit muddled, but you could probably simulate this using an HttpHandler. In fact, thinking about it, this would probably be the best way to do this.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      K 1 Reply Last reply
      0
      • P Pete OHanlon

        It's early in the morning here, so I apologise if this seems a bit muddled, but you could probably simulate this using an HttpHandler. In fact, thinking about it, this would probably be the best way to do this.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        K Offline
        K Offline
        Kasic Slobodan
        wrote on last edited by
        #3

        Thank for your reply, but could you give me any example how can I do this? I don't quite understand how can I simulate 500 internal server error with HttpHandler? On the other hand, I do use HttpHandler for captcha. Sorry for late reply. I had some issues with logging on Code Project.

        P 1 Reply Last reply
        0
        • K Kasic Slobodan

          Thank for your reply, but could you give me any example how can I do this? I don't quite understand how can I simulate 500 internal server error with HttpHandler? On the other hand, I do use HttpHandler for captcha. Sorry for late reply. I had some issues with logging on Code Project.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Kasic - if you take a look at my blog here[^] you should find the answer.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          K 1 Reply Last reply
          0
          • P Pete OHanlon

            Kasic - if you take a look at my blog here[^] you should find the answer.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            K Offline
            K Offline
            Kasic Slobodan
            wrote on last edited by
            #5

            I did take a look, but this post is written today :). I was few days ago on your blog :). Anyway, thank you for your help.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups