<?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: How to keep RETURNURL when accessing a secure page, yet disable it when logging in explicitly ?</title><link>http://forums.asp.net/thread/2330879.aspx</link><pubDate>Wed, 30 Apr 2008 20:49:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2330879</guid><dc:creator>anas</dc:creator><author>anas</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2330879.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2330879</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;I tried to change the login status control behaviour with no luck,&lt;/p&gt;&lt;p&gt;I think the only solution is to write you own login status control, I did one for you ,&lt;/p&gt;&lt;p&gt;you can accomplish that by adding a new user control and putting the following link buttons iniside it ,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt; &amp;lt;&lt;span class="tag"&gt;asp:LinkButton&lt;/span&gt;&lt;span class="attr"&gt; ID=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;LnkLogin&amp;quot;&lt;/span&gt;&lt;span class="attr"&gt; runat=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; &amp;gt;Login&amp;lt;/&lt;span class="tag"&gt;asp:LinkButton&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;&lt;span class="tag"&gt;asp:LinkButton&lt;/span&gt;&lt;span class="attr"&gt; ID=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;lnkLogout&amp;quot;&lt;/span&gt;&lt;span class="attr"&gt;  runat=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;Logout&amp;lt;/&lt;span class="tag"&gt;asp:LinkButton&lt;/span&gt;&amp;gt;&lt;/pre&gt;&amp;nbsp;&lt;br /&gt;&lt;p&gt;then in user control code behind, you handle the click events of those linkbuttons as follows: &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;    &lt;span class="kwd"&gt;Protected Sub&lt;/span&gt; LnkLogin_Click(&lt;span class="kwd"&gt;ByVal&lt;/span&gt; sender &lt;span class="kwd"&gt;As Object&lt;/span&gt;, &lt;span class="kwd"&gt;ByVal&lt;/span&gt; e &lt;span class="kwd"&gt;As&lt;/span&gt; System.EventArgs) &lt;span class="kwd"&gt;Handles&lt;/span&gt; LnkLogin.Click&lt;br /&gt;        Response.Redirect(FormsAuthentication.LoginUrl)&lt;br /&gt;    &lt;span class="kwd"&gt;End Sub&lt;br /&gt;&lt;br /&gt;    Protected Sub&lt;/span&gt; lnkLogout_Click(&lt;span class="kwd"&gt;ByVal&lt;/span&gt; sender &lt;span class="kwd"&gt;As Object&lt;/span&gt;, &lt;span class="kwd"&gt;ByVal&lt;/span&gt; e &lt;span class="kwd"&gt;As&lt;/span&gt; System.EventArgs) &lt;span class="kwd"&gt;Handles&lt;/span&gt; lnkLogout.Click&lt;br /&gt;        FormsAuthentication.SignOut()&lt;br /&gt;        Response.Redirect(FormsAuthentication.LoginUrl)&lt;br /&gt;    &lt;span class="kwd"&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Protected Sub&lt;/span&gt; Page_Load(&lt;span class="kwd"&gt;ByVal&lt;/span&gt; sender &lt;span class="kwd"&gt;As Object&lt;/span&gt;, &lt;span class="kwd"&gt;ByVal&lt;/span&gt; e &lt;span class="kwd"&gt;As&lt;/span&gt; System.EventArgs) &lt;span class="kwd"&gt;Handles Me&lt;/span&gt;.Load&lt;br /&gt;        LnkLogin.Visible = &lt;span class="kwd"&gt;Not&lt;/span&gt; Page.User.Identity.IsAuthenticated&lt;br /&gt;        lnkLogout.Visible = Page.User.Identity.IsAuthenticated&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwd"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;now , you can replace the login status control with your user control ....&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Regards,&amp;nbsp;&lt;/p&gt;</description></item><item><title>How to keep RETURNURL when accessing a secure page, yet disable it when logging in explicitly ?</title><link>http://forums.asp.net/thread/2330232.aspx</link><pubDate>Wed, 30 Apr 2008 15:05:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2330232</guid><dc:creator>S2kDriver</dc:creator><author>S2kDriver</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2330232.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2330232</wfw:commentRss><description>&lt;p&gt;I have a loginstatus control on my masterpage so that a user would have the ability to login no matter what page of the website he is on.&amp;nbsp; When he clicks on that, it brings him to the login page with the login control.&amp;nbsp; I explicitly hardcoded a specific page for the destinationpageurl attribute of the login control, but it seems the returnurl overrides that setting.&amp;nbsp; It seems the returnurl is set for the page I was previously on.&amp;nbsp; Why is the returnurl being set if I wanted to just login explicitly?&amp;nbsp; How would the hardcoded destinationpageurl ever get a chance to work then?&lt;/p&gt;
&lt;p&gt;However, the returnurl is very useful to me in other situations.&amp;nbsp; For example, say an unauthenticated user is browsing the site and he clicks on a button (or link or whatever) that leads&amp;nbsp;to a secure page (all of my secure pages are under a folder allowing only authenticated users to view them).&amp;nbsp; The site directs him automatically to the login page with the returnurl instructing the site to forward him to the intended destination after successful login.&amp;nbsp; This is desirable.&amp;nbsp; However, as stated earlier,&amp;nbsp;when a user explicitly clicks on the loginstatus to log in, I want him to be directly&amp;nbsp;led&amp;nbsp;to a specfic page (like myaccount.aspx or something).&lt;/p&gt;
&lt;p&gt;How do I do this?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;</description></item></channel></rss>