<?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: Sucessful login to go to the page you originally wanted to go to?</title><link>http://forums.asp.net/thread/2596185.aspx</link><pubDate>Tue, 02 Sep 2008 21:10:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2596185</guid><dc:creator>tlsterling</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2596185.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2596185</wfw:commentRss><description>&lt;p&gt;I know this post is a little out-dated, but for those of you who stumble onto this issue - I found that I was missing a piece of the picture.&amp;nbsp; Josh&amp;#39;s comment above stating &amp;quot;By default, the login control will redirect the user to the requested page if authentication is successful.&amp;quot; is accurate - so long as you&amp;#39;re not trying to manually complete the authentication redirection process.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;First, make sure you&amp;#39;ve eliminated anonymous access to the page the user is attempting to navigate to at the web.config level:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;authorization&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;deny users=&amp;quot;?&amp;quot;/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/authorization&amp;gt;&lt;/p&gt;&lt;p&gt;Now, if you&amp;#39;ve got any type of Membership-checking redirection functionality written into the Page_Load of your user&amp;#39;s destination - something similar to the following, take it out:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Membership.GetUser() == null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Server.Transfer(&amp;quot;Login.aspx&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; userID = (Guid)Membership.GetUser().ProviderUserKey;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (userID == null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Server.Transfer(&amp;quot;Login.aspx&amp;quot;); &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Confirm you&amp;#39;ve removed any Login control instructions for where to re-direct the user after authentication and now you should see your application behave appropriately by redirecting the user back to their originally intended destination following authentication.&amp;nbsp; &lt;/p&gt;&lt;p&gt;My problem was that I was not taking full advantage of the Membership features and allowing the application to lock the user out automatically.&amp;nbsp; In doing so, and manually re-directing the user to the Login.aspx page, the application had no idea where my user had originally intended to go.&lt;/p&gt;&lt;p&gt;I hope my ignorance and frustration helps someone else out along the way. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Sucessful login to go to the page you originally wanted to go to?</title><link>http://forums.asp.net/thread/2000753.aspx</link><pubDate>Mon, 12 Nov 2007 02:28:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2000753</guid><dc:creator>Mnemonic</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2000753.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2000753</wfw:commentRss><description>&lt;p&gt;Just for the record if anyone else has things set up like me...&amp;nbsp; I figured out a way to fix this.&lt;/p&gt;
&lt;p&gt;In the page that redirects to the login page, put in the page_load:&lt;/p&gt;
&lt;p&gt;If not user.identity.isauthenticated = true then&lt;/p&gt;
&lt;p&gt;response.redirect(&amp;quot;Login.aspx?ReturnPage=MyPage.aspx?ifyouhaveaquery=&amp;quot; &amp;amp; Whatever.text)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then in the login page (since we know they ARENT logged in) in the page_load&lt;/p&gt;
&lt;p&gt;If user.identity.isauthenticated = true then&lt;/p&gt;
&lt;p&gt;response.redirect(Request.querystring(&amp;quot;ReturnPage&amp;quot;))&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Pretty easy when ya think about it :)&lt;/p&gt;</description></item><item><title>Re: Sucessful login to go to the page you originally wanted to go to?</title><link>http://forums.asp.net/thread/1922134.aspx</link><pubDate>Sun, 23 Sep 2007 00:29:57 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1922134</guid><dc:creator>Mnemonic</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1922134.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1922134</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;XiaoYong Dai – MSFT:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Could you please paste the code snippet&amp;nbsp;so that we can find some clue?&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;Login&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;ID&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;Login1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;runat&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;server&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;BackColor&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;#C2D0E0&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;BorderColor&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;#6780B8&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;BorderStyle&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;Solid&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;BorderWidth&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;1px&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;LoginButtonImageUrl&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;~/images/login.gif&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;LoginButtonType&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;Image&amp;quot;&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;Login&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;Nothing special about this... searched the document, and default.aspx is nowhere in there...&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Sucessful login to go to the page you originally wanted to go to?</title><link>http://forums.asp.net/thread/1916050.aspx</link><pubDate>Wed, 19 Sep 2007 10:36:48 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1916050</guid><dc:creator>XiaoYong Dai – MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1916050.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1916050</wfw:commentRss><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Could you please paste the code snippet&amp;nbsp;so that we can find some clue?&lt;/p&gt;</description></item><item><title>Re: Sucessful login to go to the page you originally wanted to go to?</title><link>http://forums.asp.net/thread/1914388.aspx</link><pubDate>Tue, 18 Sep 2007 14:14:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1914388</guid><dc:creator>Mnemonic</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1914388.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1914388</wfw:commentRss><description>&lt;p&gt;I removed that, and now it takes me to Default.aspx, instead of the intended page.&lt;/p&gt;</description></item><item><title>Re: Sucessful login to go to the page you originally wanted to go to?</title><link>http://forums.asp.net/thread/1913098.aspx</link><pubDate>Mon, 17 Sep 2007 20:18:55 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1913098</guid><dc:creator>joshj</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1913098.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1913098</wfw:commentRss><description>&lt;p&gt;By default, the login control will redirect the user to the requested page if authentication is successful. Your specification of what page to&amp;nbsp;send them&amp;nbsp;to overwrites that built-in function. One solution would be to remove the specification that you declared.&lt;/p&gt;</description></item><item><title>Sucessful login to go to the page you originally wanted to go to?</title><link>http://forums.asp.net/thread/1913051.aspx</link><pubDate>Mon, 17 Sep 2007 19:45:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1913051</guid><dc:creator>Mnemonic</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1913051.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1913051</wfw:commentRss><description>&lt;p&gt;Hey all, in my login control, i can specify the page i want the user to go to if the login was sucessful, but what if the user clicked on a login-required page, then sucessfully logged in, but it throws them back to the page that i set... how would i make it send them to the page they wanted to go to originally?&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/p&gt;</description></item></channel></rss>