– Page_Load Is not Hit in SubFolder Default.aspx after Redirect to that Page – Education Career Blog

I have a page that sites in a first level folder from my root called default.aspx.

I’m redirected to that page like as so:

  1. I have an initial root Default.aspx that holds a login button
  2. User clicks the login button and it redirects to Facebook Login
  3. After logging in, Facebook redirects back to my first level Default.aspx (sits inside root\firstlevelfolder\Default.aspx)

The page_load is not being hit. This is a .NET 2.0 solution in VS 2008. The AutoEventWireup is set to true in the page directive.

Not sure why and have not seen this error before. Does it have something to do with redirecting to a non root-level .aspx page? This is probably something fundamental but I”m not sure what it is.


breakpoint in the first line of code
in my page_load

You’re using a breakpoint. Double-check that Visual Studio is in debug mode and your browser is pointing to localhost:1234 (where 1234 is some random port number assigned by the VS web server). Also, try doing a simple Response.Write("Hello World") in Page_Load(), and see if anything prints out on the top of the page.

You said to try the trace in the root.

No. Try it in the page that you think that Page_Load isn’t firing on.

Also, on StackOverflow, it is much easier for others to follow the conversation, and it makes for a cleaner post if you can reply to questions using the “add comment” feature. The reason I’m posting another answer is just in case you’re not aware of the feature and you miss the comment. See the SO Community FAQ item regarding comments.


Put a Trace="True" in your <%@ Page %> line in the “first level” Default.aspx. The part that you would want to look at is the second section – “Trace Information”. See if there is a “Begin Load” item in that list.

Also, is your page inheriting from the System.Web.UI.Page object, or do you have a custome base page?

public partial class _Default : System.Web.UI.Page //or do you have a different object here?

Does Page_Load get hit if AutoEventWireup is false?

Does the page that you are redirecting to work if you hit it directly from your browser without an intermediate page that redirects you there? I don’t think the cause of your problem has to do with the fact that the page is in a subdirectory.

If the trace is showing that Begin Load is firing, then what methodology are you using to determine that Page Load doesn’t work?

Leave a Comment