Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global.asax & Application_AuthenticateRequest event 2

Status
Not open for further replies.

LV

Programmer
Nov 1, 2000
1,184
0
0
US
ASP .Net 2.0 web application, one simple Default.aspx page with one image button in it:

Code:
<asp:ImageButton ID="imb" runat="server" ImageUrl="~/images/myImage.gif" />

Strange thing happens; in Global.asax, the Application_AuthenticateRequest fires twice when the page loads: first time with Default.aspx in HttpContext.Current.Request.Url property and the second time with myImage.gif in it (I assume, since the ImageButton is a server control ?). As long as I remember, in ASP .Net 1.1 it fired once per page requested no matter what type of controls the requested page contained. Is it new in 2.0 ?
 
Hey Lev.

Nah, it's just the default content type mappings of Visual Studio 2005's Casini web server.

When a visitor browses to a page with an image on it (or an <input type="image"> in the case of the ImageButton), there are really two requests for server resources: one for the page and one for the image. What you're experiencing is ASP.NET handling both requests.

The reason you didn't see this in ASP.NET 1.1 is that while Casini's lets ASP.NET handle requests for ALL content types including images, ASP.NET ran under IIS which, by default, doesn't route requests for static files like images to the ASP.NET worker process.

You'll actually see the same behavior in ASP.NET 1.1 if you map image types to the ASP.NET worker process:


...and you should see your ASP.NET 2.0 application behave the way you're used to once you deploy to IIS.





MCP, MCTS - .NET Framework 2.0 Web Applications
 
Hey Colin,

Good hearing from you! I just figured that this is the Casini vs. IIS issue by configuring the web site in IIS and simply running it. Your explanation makes perfect sense, as usual. Thanks man!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top