Hi MCM14,
Based on my understanding, you got the problem that the
Application_AuthorizeRequest checks all the requests including static files
like .css file and .js file. As far as I know, this issue only occurs when
we are debugging the website via ASP.NET development server of Visual
Studio.
As we know, the module that ASP.NET development server holds is different
from the one working with IIS. It makes all the requests of files go
through its application pipeline. But when the site is published to IIS,
only the requests to the specified file extensions will access the
application pipeline. This list can be found and edited in IIS.
I made a test demo to illustrate this phenomenon just using a blank ASP.NET
page linking a .css file and some simple code in
Application_AuthenticateRequest function.
//ASP.NET page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="WebApplication1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<link rel="Stylesheet" href="Stylesheet1.css" />
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
//Application_AuthenticateRequest function in Global.asax.cs
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
using (StreamWriter sw = new
StreamWriter(Server.MapPath("~/log.txt"),true,System.Text.Encoding.Default))
{
sw.Write(Request.Url.ToString() + "\r\n");
}
}
When we debug this page via Visual Studio, the log.txt will be appended
info like this:
http://localhost:6402/Default.aspx
http://localhost:6402/Stylesheet1.css
http://localhost:6402/favicon.ico
But after we publish the site to IIS 7 and run it again, the log.txt will
only have info like:
http://localhost/default.aspx
--
Sincerely,
Bravo Yang
Microsoft Online Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================