<?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: LoginControl Submit Button</title><link>http://forums.asp.net/thread/2578880.aspx</link><pubDate>Mon, 25 Aug 2008 16:33:19 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2578880</guid><dc:creator>talg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2578880.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2578880</wfw:commentRss><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the answer,This is the one i looked for,&lt;/p&gt;
&lt;p&gt;By the way Im using vs2008 - the bug still exist - is there any new resolved realease coming soon?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks again&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;utgi&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: LoginControl Submit Button</title><link>http://forums.asp.net/thread/507628.aspx</link><pubDate>Tue, 16 Mar 2004 00:36:38 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:507628</guid><dc:creator>CarlosAg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/507628.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=507628</wfw:commentRss><description>Just to complement Federico's answer, the reason for the code to be in two snippets is to split it in a different class that you can reuse from all your pages.
&lt;br /&gt;
So change the class to be public and copy it to the Code Directory.
&lt;br /&gt;

&lt;br /&gt;
Carlos</description></item><item><title>Re: LoginControl Submit Button</title><link>http://forums.asp.net/thread/507627.aspx</link><pubDate>Tue, 16 Mar 2004 00:34:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:507627</guid><dc:creator>farmas</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/507627.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=507627</wfw:commentRss><description>One way to solve the problem is create your own javascript event handler to handle the keypress (or keydown if you want to), and generate the javascript to do the postback when keycode=13 either by calling button.click(this is the one I chose to use).
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
See the code below, you can copy to Notepad and save as .aspx, notice the idea is you call SetDefaultButton in Page_Load. 
&lt;br /&gt;
Also be aware special checks should be done when the active element is a button or a link since the expected behavior when pressing enter would be not going to the default button but firing the one with the focus (this could be very easily added by checking with the event.srcElement.tagName), but I wanted to keep the sample simple.
&lt;br /&gt;

&lt;br /&gt;
Thanks
&lt;br /&gt;
Federico
&lt;br /&gt;
&lt;pre&gt;&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;%@&lt;/span&gt;&lt;span style="color=red;"&gt; Page language&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;c#&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; %&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;script&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=server&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
    &lt;span style="color=blue;"&gt;private&lt;/span&gt; &lt;span style="color=blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color=blue;"&gt;object&lt;/span&gt; sender, System.EventArgs e) {
&lt;br /&gt;
        AspHelper.SetDefaultButton(&lt;span style="color=blue;"&gt;this&lt;/span&gt;, login.ClientID + &lt;span style="color=#808080;"&gt;&amp;quot;$Button&amp;quot;&lt;/span&gt;)&lt;span style="color=blue;"&gt;;&lt;/span&gt;
&lt;br /&gt;
    }
&lt;br /&gt;
&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;script&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;html&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
    &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;body&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
        &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;form&lt;/span&gt;&lt;span style="color=red;"&gt; id&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;Form1&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; method&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;post&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
            &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:TextBox&lt;/span&gt;&lt;span style="color=red;"&gt; id&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;TextBox1&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:TextBox&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
            &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:TextBox&lt;/span&gt;&lt;span style="color=red;"&gt; id&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;TextBox2&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:TextBox&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
            &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:TextBox&lt;/span&gt;&lt;span style="color=red;"&gt; id&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;TextBox3&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:TextBox&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
            &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:Button&lt;/span&gt;&lt;span style="color=red;"&gt; id&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;Button1&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; Text&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;Button1&amp;quot;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:Button&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
            &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:Button&lt;/span&gt;&lt;span style="color=red;"&gt; id&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;Button2&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; Text&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;Button2&amp;quot;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:Button&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
    &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;asp:login&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=server&lt;/span&gt;&lt;span style="color=red;"&gt; id&lt;/span&gt;&lt;span style="color=blue;"&gt;=&amp;quot;login&amp;quot;&lt;/span&gt;&lt;span style="color=red;"&gt; &lt;/span&gt;&lt;span style="color=blue;"&gt;/&amp;gt;&lt;/span&gt;
&lt;br /&gt;
        &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;form&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
    &lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;body&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;html&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;script&lt;/span&gt;&lt;span style="color=red;"&gt; runat&lt;/span&gt;&lt;span style="color=blue;"&gt;=server&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;br /&gt;
  &lt;span style="color=blue;"&gt;class&lt;/span&gt; AspHelper {
&lt;br /&gt;
  &lt;span style="color=blue;"&gt;public&lt;/span&gt; &lt;span style="color=blue;"&gt;static&lt;/span&gt; &lt;span style="color=blue;"&gt;void&lt;/span&gt; SetDefaultButton(Page page, Button button) {
&lt;br /&gt;
          SetDefaultButton(page, button.ClientID)&lt;span style="color=blue;"&gt;;&lt;/span&gt;
&lt;br /&gt;
      }
&lt;br /&gt;
      &lt;span style="color=blue;"&gt;public&lt;/span&gt; &lt;span style="color=blue;"&gt;static&lt;/span&gt; &lt;span style="color=blue;"&gt;void&lt;/span&gt; SetDefaultButton(Page page, &lt;span style="color=blue;"&gt;string&lt;/span&gt; clientID) {
&lt;br /&gt;
    &lt;span style="color=blue;"&gt;if&lt;/span&gt; (!page.IsClientScriptBlockRegistered(&lt;span style="color=#808080;"&gt;&amp;quot;MyFocus&amp;quot;&lt;/span&gt;))
&lt;br /&gt;
      page.RegisterClientScriptBlock(&lt;span style="color=#808080;"&gt;&amp;quot;MyFocus&amp;quot;&lt;/span&gt;,&lt;span style="color=#808080;"&gt;&amp;quot;&amp;lt;script&amp;gt;&amp;quot;&lt;/span&gt; + 
&lt;br /&gt;
        &lt;span style="color=#808080;"&gt;&amp;quot;var defaultButton=null;function document.onkeypress(){if (defaultButton==null || window.event.keyCode!=13) return;&amp;quot;&lt;/span&gt; +
&lt;br /&gt;
        &lt;span style="color=#808080;"&gt;&amp;quot;defaultButton.click();window.event.returnValue = false;return false;}&amp;lt;/&amp;quot;&lt;/span&gt; + &lt;span style="color=#808080;"&gt;&amp;quot;script&amp;gt;&amp;quot;&lt;/span&gt;)&lt;span style="color=blue;"&gt;;&lt;/span&gt;
&lt;br /&gt;
          page.RegisterStartupScript(&lt;span style="color=#808080;"&gt;&amp;quot;setDefault&amp;quot;&lt;/span&gt;, &lt;span style="color=#808080;"&gt;&amp;quot;&amp;lt;script&amp;gt;defaultButton = document.all['&amp;quot;&lt;/span&gt; + clientID + &lt;span style="color=#808080;"&gt;&amp;quot;'];&amp;lt;/&amp;quot;&lt;/span&gt; + &lt;span style="color=#808080;"&gt;&amp;quot;script&amp;gt;&amp;quot;&lt;/span&gt;)&lt;span style="color=blue;"&gt;;&lt;/span&gt;
&lt;br /&gt;
      }
&lt;br /&gt;
  }
&lt;br /&gt;
&lt;span style="color=blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color=maroon;"&gt;&lt;/span&gt;&lt;span style="color=blue;"&gt;/&lt;/span&gt;&lt;span style="color=maroon;"&gt;script&lt;/span&gt;&lt;span style="color=blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;</description></item><item><title>Re: LoginControl Submit Button</title><link>http://forums.asp.net/thread/507605.aspx</link><pubDate>Mon, 15 Mar 2004 23:59:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:507605</guid><dc:creator>farmas</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/507605.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=507605</wfw:commentRss><description>Hello Horatio,
&lt;br /&gt;

&lt;br /&gt;
This is a bug in the control for the Alpha release, it has been fixed for Beta 1, so there will be no additional code required to make the scenario you are trying to solve work.
&lt;br /&gt;

&lt;br /&gt;
In the meantime, I am afraid the only option is to template the control and add your javascript there. I'll try to look for a sample and post it here.
&lt;br /&gt;

&lt;br /&gt;
Thanks,
&lt;br /&gt;
Federico</description></item><item><title>LoginControl Submit Button</title><link>http://forums.asp.net/thread/502778.aspx</link><pubDate>Thu, 11 Mar 2004 00:16:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:502778</guid><dc:creator>horatio05</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/502778.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=502778</wfw:commentRss><description>I'm attempting to make my login control submit when a user types in their username and password and then pushes the 'Enter' key. I've seen that this normally takes a little playing around with the Button's OnClick event and the TextBox's OnTextChange event, but it seems that the submit button for the Login control has it's Command event hidden so I'm not sure how I would make this happen. Any ideas? Thanks.</description></item></channel></rss>