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. Page level error in ASP.NET

Page level error in ASP.NET

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-nettutorialquestion
6 Posts 3 Posters 0 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.
  • N Offline
    N Offline
    Neha_Gupta
    wrote on last edited by
    #1

    Can anyone tell me how to apply Page_Error in ASP.NET? I have written the following code in some.aspx.cs file. protected void Button1_Click(object sender, EventArgs e) { int[] a=new int[5]; a[5] = 0; } public void Page_Error(object sender, EventArgs e) { Response.Write("Error occured..."); } Where I am making mistake? Please help....

    NEHA GUPTA

    K T 2 Replies Last reply
    0
    • N Neha_Gupta

      Can anyone tell me how to apply Page_Error in ASP.NET? I have written the following code in some.aspx.cs file. protected void Button1_Click(object sender, EventArgs e) { int[] a=new int[5]; a[5] = 0; } public void Page_Error(object sender, EventArgs e) { Response.Write("Error occured..."); } Where I am making mistake? Please help....

      NEHA GUPTA

      K Offline
      K Offline
      Kannan Ar
      wrote on last edited by
      #2

      Ok you implemented the page error event to write a string to output stream. It will fire whenever the page encounter an error. So what is your problem? What you want to attain?

      N 1 Reply Last reply
      0
      • K Kannan Ar

        Ok you implemented the page error event to write a string to output stream. It will fire whenever the page encounter an error. So what is your problem? What you want to attain?

        N Offline
        N Offline
        Neha_Gupta
        wrote on last edited by
        #3

        I am getting an exception instead of getting response on the web page.

        NEHA GUPTA

        K 1 Reply Last reply
        0
        • N Neha_Gupta

          I am getting an exception instead of getting response on the web page.

          NEHA GUPTA

          K Offline
          K Offline
          Kannan Ar
          wrote on last edited by
          #4

          Then you have to call Server.ClearError to prevent further error processing.

          N 1 Reply Last reply
          0
          • K Kannan Ar

            Then you have to call Server.ClearError to prevent further error processing.

            N Offline
            N Offline
            Neha_Gupta
            wrote on last edited by
            #5

            As said by you, I applied Server.ClearError() in Page_Error event but still same output.

            NEHA GUPTA

            1 Reply Last reply
            0
            • N Neha_Gupta

              Can anyone tell me how to apply Page_Error in ASP.NET? I have written the following code in some.aspx.cs file. protected void Button1_Click(object sender, EventArgs e) { int[] a=new int[5]; a[5] = 0; } public void Page_Error(object sender, EventArgs e) { Response.Write("Error occured..."); } Where I am making mistake? Please help....

              NEHA GUPTA

              T Offline
              T Offline
              Tej Aj
              wrote on last edited by
              #6

              U just need to modify Page_Error()

              public void Page_Error(object sender, EventArgs e)
              {
              Response.Write("Error occured...");
              Server.ClearError();
              }

              Teja Aj, http://opexsolution.com/forum/[^] Fan of: http://www.abtstudioz.com/[^]

              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