DNR
DNR

Reputation: 3746

Response.Redirect leading to custom Error.aspx page in asp.net

I have a web application where I am doing a Response.Redirect("Register.aspx") page in a button_click event. However, when I am step through this code, when the Response.Redirect("Register.aspx") statement executes... the browser becomes the active window & the status bar below says "waiting for response from localhost..." and then after 5 seconds the custom error page is displayed.

How can I debug this to see what is causing the error page to be displayed?

Upvotes: 1

Views: 3932

Answers (4)

Justin Helgerson
Justin Helgerson

Reputation: 25551

Since you said there is a pause, I'm assuming the redirect is working and you're hitting the issue on your Register.aspx page.

  1. Temporarily turn off custom errors to see the real exception message.
  2. Put exception handling in your Register.aspx page and log the error so you can view the exception messsage.
  3. Put exception handling in the Global.asax Application_Error method to catch all application errors and log it.
  4. Check the Event Viewer

Upvotes: 4

Harry89pl
Harry89pl

Reputation: 2435

u can try Response.Redirect("~/Register.aspx",false);

The second parameter prevent break of current thread.

Upvotes: 0

mamoo
mamoo

Reputation: 8166

You have several ways to check what's happening. To begin you can turn off custom errors in web.config, if not already done, and add, if not already present, the global application file Global.asax. This file defines the Application_Error method, in which you can set a breakpoint to see what happens.

See also: http://msdn.microsoft.com/en-us/library/24395wz3.aspx

Upvotes: 1

Eric
Eric

Reputation: 1366

You should have a log somewhere on your computer in the form a text file, which has generated runtime error messages.

Upvotes: 0

Related Questions