tags:

views:

523

answers:

10

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.

A: 

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?

Terrapin
A: 

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.

yes

Also, is your page inheriting from the System.Web.UI.Page object

Yes

But the problem is in my second level page, the page being directed to after it leaves the facebook login URL and redirects back to my host web page.

About the only other thing I can think of is that I'm redirecting to one of my hosts entry that points to localhost...but I don't think that should matter because the .aspx page is definitely loading in terms of showing mark-up. I do not have any controls in my .aspx page yet, just some test text.

CoffeeAddict
How are you determining that Page_Load doesn't fire? Do you have a Response.Write() that isn't firing?
Terrapin
A: 

Does Page_Load get hit if AutoEventWireup is false?

No..tried that already. In fact if I try to redirect to a new page I created in the root just to test the redirect in a non-sub folder instead, its page load also doesn't fire...wtf

CoffeeAddict
A: 

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

You said to try the trace in the root. That's not where my page resides that I'm redirecting to. I said the page I'm rediecting to resides in a subfolder (first level folder) from the root.

But that doesn't matter as I just tried to instead redirect to a page in root and it still did not work even though the trace on that page that I tested in root for the redirect has Begin Load showing up

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

breakpoint in the first line of code in my page_load

CoffeeAddict
A: 
Category    Message From First(s) From Last(s)
aspx.page   Begin PreInit  
aspx.page   End PreInit 1.70412720052409E-05 0.000017
aspx.page   Begin Init 3.12888928620816E-05 0.000014
aspx.page   End Init 4.53269898827924E-05 0.000014
aspx.page   Begin InitComplete 5.51746101809029E-05 0.000010
aspx.page   End InitComplete 6.54412781512734E-05 0.000010
aspx.page   Begin PreLoad 8.48571536326544E-05 0.000019
aspx.page   End PreLoad 9.98031872765952E-05 0.000015
aspx.page   Begin Load 0.000110000013968256 0.000010
aspx.page   End Load 0.000227333362201062 0.000117
aspx.page   Begin LoadComplete 0.000240742887713383 0.000013
aspx.page   End LoadComplete 0.000251288920798593 0.000011
aspx.page   Begin PreRender 0.000261276223654124 0.000010
aspx.page   End PreRender 0.000275454003232254 0.000014
aspx.page   Begin PreRenderComplete 0.000286349242711015 0.000011
aspx.page   End PreRenderComplete 0.000300666704846566 0.000014
aspx.page   Begin SaveState 0.000425961958852312 0.000125
aspx.page   End SaveState 0.000675015958732185 0.000249
aspx.page   Begin SaveStateComplete 0.000688704849359346 0.000014
aspx.page   End SaveStateComplete 0.000699111199887136 0.000010
aspx.page   Begin Render 0.000709028661463957 0.000010
aspx.page   End Render 0.000866171538561465 0.000157
CoffeeAddict
A: 

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.

Terrapin
>>> 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" featureI'll take not of that for next time
CoffeeAddict
thanks. Glad I was able to help, and good luck
Terrapin
A: 

I also have and always have in my dev environment. This is weird.

CoffeeAddict
A: 

Double-check that Visual Studio is in debug mode and your browser is pointing to localhost:1234

Broswer is pointing to a fake domain url that I have set in my hosts file to point to localhost.

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

I already did that same result, there is a load.

Double-check that Visual Studio is in debug mode and your browser is pointing to localhost:1234

I tried both using the web server and not. Probably because I'm using the fake domain name that points to localhost is why. But I did even change the url to localhost manually in the url then attached VS to the process and it still didn't even it it

CoffeeAddict
The reason Page_Load isn't firing is because you are not using the Visual Studio debugger. Either use the debugger (hit F5 and it will open in a new browser for you), or do a Response.Write() in Page_Load() to see if it is firing.
Terrapin
A: 

Is there a way to account for the port number that VS web server needs in a hosts file?

CoffeeAddict
A: 

Thanks, I needed to either

1) use the straight up localhost:port number

2) attach to the process that is handing the page...don't use the VS server

Because I was testing over a fake domain using my hosts file, that's why it was not attaching.

CoffeeAddict