<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Security</title><link>http://forums.asp.net/25.aspx</link><description>All about ASP.NET security (authentication, authorization, membership, roles, etc.) and the Login controls. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=24&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: AuthenticateRequest always fires</title><link>http://forums.asp.net/thread/1254127.aspx</link><pubDate>Tue, 11 Apr 2006 10:42:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1254127</guid><dc:creator>Ashiki</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1254127.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1254127</wfw:commentRss><description>&lt;p&gt;&lt;font face=Verdana size=2&gt;I think that's the answer! I've set the loginUrl in web.config to the external site and handle the FormsAuthenticationModule Authenticate event in a HTTP Module to check for authenticated users being redirected back from the external site. It seems to work fine.&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: AuthenticateRequest always fires</title><link>http://forums.asp.net/thread/1253583.aspx</link><pubDate>Mon, 10 Apr 2006 21:09:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1253583</guid><dc:creator>sschack</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1253583.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1253583</wfw:commentRss><description>&lt;p&gt;It looks like the forms authentication module is always going to get in the way.&amp;nbsp; I see two solutions to this:&lt;/p&gt;
&lt;p&gt;1.)&amp;nbsp; Hook the EndRequest event.&amp;nbsp; Look for a Response.StatusCode of 302 &lt;strong&gt;and&lt;/strong&gt; Response.RedirectLocation set to the login page for the application.&amp;nbsp; This combination of data indicates that the current request failed authorization to the requested page.&lt;/p&gt;
&lt;p&gt;2.)&amp;nbsp; Set the "loginUrl" attribute for your application to the remote application that has the real login page:&amp;nbsp; &amp;lt;forms ... loginUrl="&lt;a href="http://www.myloginapp.com/login.aspx"&gt;http://www.myloginapp.com/login.aspx&lt;/a&gt;" /&amp;gt;&lt;/p&gt;</description></item><item><title>Re: AuthenticateRequest always fires</title><link>http://forums.asp.net/thread/1252763.aspx</link><pubDate>Mon, 10 Apr 2006 08:03:44 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1252763</guid><dc:creator>Ashiki</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1252763.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1252763</wfw:commentRss><description>&lt;font face=Verdana size=2&gt;The login page is on another domain. That's why I want to handle the page request before forms authentication does, but only if the page is configured in web.config to disallow anonymous access.&lt;/font&gt;</description></item><item><title>Re: AuthenticateRequest always fires</title><link>http://forums.asp.net/thread/1251404.aspx</link><pubDate>Fri, 07 Apr 2006 17:57:57 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1251404</guid><dc:creator>sschack</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1251404.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1251404</wfw:commentRss><description>I guess the question is what do you need to do in the app?&amp;nbsp; If you just want to change the login page, you can set the "loginUrl" attribute on the &amp;lt;forms /&amp;gt; element to your sign in&amp;nbsp;page.</description></item><item><title>Re: AuthenticateRequest always fires</title><link>http://forums.asp.net/thread/1250844.aspx</link><pubDate>Fri, 07 Apr 2006 10:40:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1250844</guid><dc:creator>Ashiki</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1250844.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1250844</wfw:commentRss><description>&lt;p&gt;&lt;font face=Verdana size=2&gt;I always get statuscodes of 200 or 302 from EndRequest. I think this is because the&amp;nbsp;page is either available to unauthorized users (200) or the user is being redirected by forms authentication (302) and then landing on the login.aspx page (200) (which I haven't configured as "login.aspx" in web.config, that just seems to be the default). So I guess what I want to do is to get access to the HTTP pipeline before forms authentication does - anyone know how to do that? I've tried the code below but without success:&lt;/font&gt;&lt;/p&gt;&lt;font color=#0000ff size=2&gt;
&lt;p&gt;&lt;font color=#0000ff size=2&gt;Public&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Sub&lt;/font&gt;&lt;font color=#000000 size=2&gt; Init(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;ByVal&lt;/font&gt;&lt;font color=#000000 size=2&gt; context &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font color=#000000 size=2&gt; System.Web.HttpApplication) &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Implements&lt;/font&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; System.Web.IHttpModule.Init&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;Dim&lt;font size=2&gt; instance &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; FormsAuthenticationModule&lt;/font&gt;&lt;font size=2&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color=#0000ff size=2&gt;AddHandler&lt;/font&gt;&lt;font size=2&gt; instance.Authenticate, &lt;font color=#008000 size=2&gt;&lt;font color=#0000ff&gt;AddressOf &lt;/font&gt;&amp;nbsp;&lt;font color=#000000&gt;Me.Forms_AuthenticateRequest&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;&lt;font color=#0000ff size=2&gt;End Sub&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;&lt;font color=#008000 size=2&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;font size=2&gt;&lt;font color=#008000 size=2&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff&gt;&lt;font size=2&gt;Private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font size=2&gt;Sub&lt;/font&gt;&lt;font size=2&gt; Forms_AuthenticateRequest(&lt;/font&gt;&lt;font size=2&gt;ByVal&lt;/font&gt;&lt;font size=2&gt; Source &lt;/font&gt;&lt;font size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font size=2&gt;Object&lt;/font&gt;&lt;font size=2&gt;, &lt;/font&gt;&lt;font size=2&gt;ByVal&lt;/font&gt;&lt;font size=2&gt; e &lt;/font&gt;&lt;font size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; Web.Security.FormsAuthenticationEventArgs)&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;'do stuff here&lt;/p&gt;
&lt;p&gt;&lt;font color=#0000ff&gt;End Sub&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: AuthenticateRequest always fires</title><link>http://forums.asp.net/thread/1250304.aspx</link><pubDate>Thu, 06 Apr 2006 19:43:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1250304</guid><dc:creator>sschack</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1250304.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1250304</wfw:commentRss><description>&lt;p&gt;AuthenticateRequest is an event that occurs in the Http pipeline - which is why an event handler that subscribes to this will get called on each request.&amp;nbsp; Usually this is the event where code looks for some value in the request (a cookie, a header, etc...) and if this value is found, converts it into a principal object that is placed on the HttpContext.&lt;/p&gt;
&lt;p&gt;If the intent is to determine if authorization failed, and a redirect is needed to a login page, you can hook the EndRequest event.&amp;nbsp; If the value of Response.StatusCode is 401, this indicates that an authorization failure occurred (probably from UrlAuthorization).&amp;nbsp; In this case you can then redirect to an appropriate login page.&lt;/p&gt;</description></item><item><title>AuthenticateRequest always fires</title><link>http://forums.asp.net/thread/1249633.aspx</link><pubDate>Thu, 06 Apr 2006 09:56:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1249633</guid><dc:creator>Ashiki</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1249633.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1249633</wfw:commentRss><description>&lt;font color=#0000ff size=2&gt;
&lt;p&gt;&lt;font face=Verdana color=#000000&gt;I have a HTTP Module that grabs the AuthenticateRequest and checks the current user's credentials. It all works fine and I thought that I could specify the pages that should be under this system by using web.config like so:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;location&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;path&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="SignUp.aspx"&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;system.web&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;authorization&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;allow&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;users&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="*"&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;/&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;authorization&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;system.web&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;location&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;location&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;path&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Users.aspx"&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;system.web&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;authorization&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;deny&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;users&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="?"&lt;/font&gt;&lt;font color=#ff00ff size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;/&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;authorization&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;system.web&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;location&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&lt;/font&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face=Verdana color=#000000&gt;.. in which case users.aspx would require authorization but signup.aspx would not. It seems that AuthenticateRequest fires on every page no matter what and there's no method I can find to check whether to run code - such as a FormsAuthentication.IsRequired, or something like that. I've tried using AuthorizeRequest instead but that gives the same result and I've found the &lt;font face="Times New Roman"&gt;&lt;font face=Verdana color=#000000&gt;UrlAuthorizationModule.CheckUrlAccessForPrincipal method in 2.0, but I'm using 1.1 !&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Verdana color=#000000&gt;So, how do you check if authorization is required?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;'example code from httpmodule&lt;/p&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;Private&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Sub&lt;/font&gt;&lt;font size=2&gt; Application_AuthenticateRequest(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;ByVal&lt;/font&gt;&lt;font size=2&gt; Source &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Object&lt;/font&gt;&lt;font size=2&gt;, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;ByVal&lt;/font&gt;&lt;font size=2&gt; e &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; EventArgs)&lt;/font&gt;
&lt;p&gt;&lt;font size=2&gt;'do stuff here&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;Public&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Sub&lt;/font&gt;&lt;font size=2&gt; Init(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;ByVal&lt;/font&gt;&lt;font size=2&gt; context &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; System.Web.HttpApplication) &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Implements&lt;/font&gt;&lt;font size=2&gt; System.Web.IHttpModule.Init&lt;/font&gt;
&lt;p&gt;AddHandler&lt;font size=2&gt; context.AuthenticateRequest, &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AddressOf&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Me&lt;/font&gt;&lt;font size=2&gt;.Application_AuthenticateRequest&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;End Sub&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;&amp;nbsp;&lt;/font&gt;&lt;/p&gt;</description></item></channel></rss>