<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ASP.Net MVC and Forms Authentication</title>
	<atom:link href="http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/</link>
	<description>Improving my craft...</description>
	<lastBuildDate>Mon, 07 Dec 2009 20:47:46 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ryan</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-488</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Thu, 27 Mar 2008 14:28:25 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-488</guid>
		<description>The NullReference exception is likely a result of the Request[&quot;ReturnUrl&quot;].  It is a bit presumptuous of me to assume that you&#039;ll be arriving at the Login.aspx page from another page that was unable to authorize/authenticate you.  You may wish to do a safer &quot;get&quot; of the ReturnUrl.

As for the PrinciplePermission attribute, it wouldn&#039;t hurt to have a full solution for that, but I hadn&#039;t planned on it.  I do agree that it&#039;s a bit more clean to apply the attribute see as changing your Routes would change your urls and, thus, the config authorization.

I&#039;ll do what I can to post an example soon.</description>
		<content:encoded><![CDATA[<p>The NullReference exception is likely a result of the Request["ReturnUrl"].  It is a bit presumptuous of me to assume that you&#8217;ll be arriving at the Login.aspx page from another page that was unable to authorize/authenticate you.  You may wish to do a safer &#8220;get&#8221; of the ReturnUrl.</p>
<p>As for the PrinciplePermission attribute, it wouldn&#8217;t hurt to have a full solution for that, but I hadn&#8217;t planned on it.  I do agree that it&#8217;s a bit more clean to apply the attribute see as changing your Routes would change your urls and, thus, the config authorization.</p>
<p>I&#8217;ll do what I can to post an example soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dewy</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-487</link>
		<dc:creator>Dewy</dc:creator>
		<pubDate>Thu, 27 Mar 2008 14:12:40 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-487</guid>
		<description>Hi Ryan, this is exatcly what I am looking for, well at least I think that it is. I am using the Preview 2 download and so I had to make some changes to the web.config file to ref those files instead. I also had to change the Html.Form parameters around as these have been altered I guess for Prev2.

When I try to run my app, it goes into debug and stops on the User/Login.aspx and highlights the using statement and says that there is a NullReference exception. Its drving me nuts. Any ideas?

Also, I have done a bit of searching on this and I have also seen that you can use the PrinciplePermission attribute on the controllers themselves or in a base class or whatnot and I like this idea better as this means that you don&#039;t have to use hard coded paths in the config file. Are you planning on updateing your example to use the new release?

Cheers
Dewy</description>
		<content:encoded><![CDATA[<p>Hi Ryan, this is exatcly what I am looking for, well at least I think that it is. I am using the Preview 2 download and so I had to make some changes to the web.config file to ref those files instead. I also had to change the Html.Form parameters around as these have been altered I guess for Prev2.</p>
<p>When I try to run my app, it goes into debug and stops on the User/Login.aspx and highlights the using statement and says that there is a NullReference exception. Its drving me nuts. Any ideas?</p>
<p>Also, I have done a bit of searching on this and I have also seen that you can use the PrinciplePermission attribute on the controllers themselves or in a base class or whatnot and I like this idea better as this means that you don&#8217;t have to use hard coded paths in the config file. Are you planning on updateing your example to use the new release?</p>
<p>Cheers<br />
Dewy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-486</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Mon, 04 Feb 2008 03:30:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-486</guid>
		<description>Count me in!  I&#039;d love to make it there regardless, but a beer only helps the case.</description>
		<content:encoded><![CDATA[<p>Count me in!  I&#8217;d love to make it there regardless, but a beer only helps the case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesper Christiansen</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-485</link>
		<dc:creator>Jesper Christiansen</dc:creator>
		<pubDate>Sun, 03 Feb 2008 20:54:25 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-485</guid>
		<description>Thank you soo much! That gave me a few gray hairs trying to solve that one :) (Im still a little new in the asp.net world) ..

if you ever stop by Copenhagen, Denmark - I owe you a beer! :)</description>
		<content:encoded><![CDATA[<p>Thank you soo much! That gave me a few gray hairs trying to solve that one <img src='http://blog.cromwellhaus.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (Im still a little new in the asp.net world) ..</p>
<p>if you ever stop by Copenhagen, Denmark &#8211; I owe you a beer! <img src='http://blog.cromwellhaus.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-484</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Sun, 03 Feb 2008 20:00:04 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-484</guid>
		<description>Jesper,

It likely did create the database, but, initially, it&#039;s not added to the project in the sense you may be expecting.  The SQL Express MDF is likely just not &quot;included&quot; in the Visual Studio project.  In the Solution Explorer, there is a button at the top called &quot;Show All Files&quot;.  Click that and see if the ASPNETDB.mdf is not in the App_Data directory.  </description>
		<content:encoded><![CDATA[<p>Jesper,</p>
<p>It likely did create the database, but, initially, it&#8217;s not added to the project in the sense you may be expecting.  The SQL Express MDF is likely just not &#8220;included&#8221; in the Visual Studio project.  In the Solution Explorer, there is a button at the top called &#8220;Show All Files&#8221;.  Click that and see if the ASPNETDB.mdf is not in the App_Data directory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesper Christiansen</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-483</link>
		<dc:creator>Jesper Christiansen</dc:creator>
		<pubDate>Sun, 03 Feb 2008 19:38:17 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-483</guid>
		<description>Hmm.. I simply dont get it! I can easily add users and roles in the &quot;Web Site Administration&quot; web-interface.. but it never creates a database for me.. Atleast not under my current project..

Any idea of what I might be doing wrong? It seems to by working on projects that are not MVC websites.</description>
		<content:encoded><![CDATA[<p>Hmm.. I simply dont get it! I can easily add users and roles in the &#8220;Web Site Administration&#8221; web-interface.. but it never creates a database for me.. Atleast not under my current project..</p>
<p>Any idea of what I might be doing wrong? It seems to by working on projects that are not MVC websites.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-482</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Tue, 08 Jan 2008 13:40:49 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-482</guid>
		<description>You can do a number of things.  You can authorize the Edit url itself by using /Products/Edit as the location element.  You can authorize the Edit ControllerAction method via the PrincipalPermission attribute.  Of course, you could do it manually in code as well by asserting role membership.</description>
		<content:encoded><![CDATA[<p>You can do a number of things.  You can authorize the Edit url itself by using /Products/Edit as the location element.  You can authorize the Edit ControllerAction method via the PrincipalPermission attribute.  Of course, you could do it manually in code as well by asserting role membership.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Israel Aece</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-481</link>
		<dc:creator>Israel Aece</dc:creator>
		<pubDate>Tue, 08 Jan 2008 11:33:17 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-481</guid>
		<description>Hello Ryan,

What&#039;s the solution when we need to protect the URL like /Products/Edit/1 where &quot;1&quot; is a productId?</description>
		<content:encoded><![CDATA[<p>Hello Ryan,</p>
<p>What&#8217;s the solution when we need to protect the URL like /Products/Edit/1 where &#8220;1&#8243; is a productId?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-480</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Wed, 02 Jan 2008 16:24:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-480</guid>
		<description>I don&#039;t have my sample here at the office, but I&#039;ll verify this evening.  My current project using this tehcnique does include two actions within the same controller (ResourceController) which are authorized differently.  The resource/upload action is only available to authenticated users, while resource/list is available for all users, including anonymous.  I will confirm this and try to post an updated sample this evening.

Do you have a specific reason or example why you feel this doesn&#039;t work as expected?  You may wish to add the trailing slash.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t have my sample here at the office, but I&#8217;ll verify this evening.  My current project using this tehcnique does include two actions within the same controller (ResourceController) which are authorized differently.  The resource/upload action is only available to authenticated users, while resource/list is available for all users, including anonymous.  I will confirm this and try to post an updated sample this evening.</p>
<p>Do you have a specific reason or example why you feel this doesn&#8217;t work as expected?  You may wish to add the trailing slash.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://blog.cromwellhaus.com/index.php/2007/12/asp-net-mvc-and-forms-authentication/comment-page-1/#comment-479</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Wed, 02 Jan 2008 16:17:01 +0000</pubDate>
		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/19/asp-net-mvc-and-forms-authentication.aspx#comment-479</guid>
		<description>Your technique works, however, it will only work a the controller level.  If you want to secure an action, it won&#039;t work.  For example, if you had secure/admin and secure/index.  If you only want secure/admin to be secured you&#039;d add &lt;location path=&quot;secure/admin&quot;&gt;.  This does not work as expected.  

~ Paul</description>
		<content:encoded><![CDATA[<p>Your technique works, however, it will only work a the controller level.  If you want to secure an action, it won&#8217;t work.  For example, if you had secure/admin and secure/index.  If you only want secure/admin to be secured you&#8217;d add <location path="secure/admin">.  This does not work as expected.  </p>
<p>~ Paul</location></p>
]]></content:encoded>
	</item>
</channel>
</rss>
