{"id":188,"date":"2010-12-27T11:35:22","date_gmt":"2010-12-27T15:35:22","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=188"},"modified":"2011-01-17T17:18:03","modified_gmt":"2011-01-17T21:18:03","slug":"simple-net-login-application","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2010\/12\/simple-net-login-application\/","title":{"rendered":"Login"},"content":{"rendered":"<p><strong>~ Simple login application ~<\/strong><\/p>\n<p>Web.config<\/p>\n<blockquote><p>&lt;system.web&gt;<\/p>\n<p>&lt;authentication mode=&#8221;Forms&#8221;&gt;<\/p>\n<p>&lt;forms loginUrl=&#8221;~\/ Login.aspx&#8221; timeout=&#8221;2880&#8243;\/&gt;<\/p>\n<p>&lt;\/authentication&gt;<\/p>\n<p>&lt;\/system.web&gt;<\/p><\/blockquote>\n<p>Login.aspx<\/p>\n<blockquote><p>&lt;asp:Label ID=&#8221;UserNameLabel&#8221; runat=&#8221;server&#8221; AssociatedControlID=&#8221;UserName&#8221;&gt;User Name:&lt;\/asp:Label&gt;<\/p>\n<p>&lt;asp:TextBox ID=&#8221;UserName&#8221; runat=&#8221;server&#8221;&gt;&lt;\/asp:TextBox&gt;<\/p>\n<p>&lt;asp:RequiredFieldValidator ID=&#8221;UserNameRequired&#8221; runat=&#8221;server&#8221;<br \/>\nControlToValidate=&#8221;UserName&#8221; ErrorMessage=&#8221;User Name is required.&#8221;<br \/>\nToolTip=&#8221;User Name is required.&#8221; ValidationGroup=&#8221;Login1&#8243;&gt;*<br \/>\n&lt;\/asp:RequiredFieldValidator&gt;<\/p>\n<p>&lt;asp:Label ID=&#8221;PasswordLabel&#8221; runat=&#8221;server&#8221; AssociatedControlID=&#8221;Password&#8221;&gt;Password:&lt;\/asp:Label&gt;<\/p>\n<p>&lt;asp:TextBox ID=&#8221;Password&#8221; runat=&#8221;server&#8221; TextMode=&#8221;Password&#8221;&gt;&lt;\/asp:TextBox&gt;<\/p>\n<p>&lt;asp:RequiredFieldValidator ID=&#8221;PasswordRequired&#8221; runat=&#8221;server&#8221;<br \/>\nControlToValidate=&#8221;Password&#8221; ErrorMessage=&#8221;Password is required.&#8221;<br \/>\nToolTip=&#8221;Password is required.&#8221; ValidationGroup=&#8221;Login1&#8243;&gt;*&lt;\/asp:RequiredFieldValidator&gt;<\/p>\n<p>&lt;asp:Literal ID=&#8221;FailureText&#8221; runat=&#8221;server&#8221; EnableViewState=&#8221;False&#8221;&gt;&lt;\/asp:Literal&gt;<\/p>\n<p>&lt;asp:Button ID=&#8221;LoginButton&#8221; runat=&#8221;server&#8221; CommandName=&#8221;Login&#8221; Text=&#8221;Log In&#8221; ValidationGroup=&#8221;Login1&#8243; \/&gt;<\/p><\/blockquote>\n<p>Login.aspx.vb<\/p>\n<blockquote><p>Partial Class Login<br \/>\nInherits System.Web.UI.Page<\/p>\n<p>Function SiteSpecificAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean<br \/>\n&#8216; Insert code that implements a site-specific custom<br \/>\n&#8216; authentication method here.<br \/>\nIf UserName = &#8220;YourUsn&#8221; And Password = &#8220;YourPwd&#8221; Then<br \/>\nResponse.Redirect(&#8220;YourPage.aspx&#8221;)<br \/>\nEnd If<br \/>\n&#8216; This example implementation always returns false.<br \/>\nReturn False<br \/>\nEnd Function<\/p>\n<p>Sub OnAuthenticate(ByVal sender As Object, ByVal e As AuthenticateEventArgs)<br \/>\nDim Authenticated As Boolean<br \/>\nAuthenticated = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)<\/p>\n<p>e.Authenticated = Authenticated<br \/>\nEnd Sub<\/p>\n<p>End Class<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>~ Simple login application ~ Web.config &lt;system.web&gt; &lt;authentication mode=&#8221;Forms&#8221;&gt; &lt;forms loginUrl=&#8221;~\/ Login.aspx&#8221; timeout=&#8221;2880&#8243;\/&gt; &lt;\/authentication&gt; &lt;\/system.web&gt; Login.aspx &lt;asp:Label ID=&#8221;UserNameLabel&#8221; runat=&#8221;server&#8221; AssociatedControlID=&#8221;UserName&#8221;&gt;User Name:&lt;\/asp:Label&gt; &lt;asp:TextBox ID=&#8221;UserName&#8221; runat=&#8221;server&#8221;&gt;&lt;\/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ID=&#8221;UserNameRequired&#8221; runat=&#8221;server&#8221; ControlToValidate=&#8221;UserName&#8221; ErrorMessage=&#8221;User Name is required.&#8221; ToolTip=&#8221;User Name is required.&#8221; ValidationGroup=&#8221;Login1&#8243;&gt;* &lt;\/asp:RequiredFieldValidator&gt; &lt;asp:Label ID=&#8221;PasswordLabel&#8221; runat=&#8221;server&#8221; AssociatedControlID=&#8221;Password&#8221;&gt;Password:&lt;\/asp:Label&gt; &lt;asp:TextBox ID=&#8221;Password&#8221; runat=&#8221;server&#8221; TextMode=&#8221;Password&#8221;&gt;&lt;\/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ID=&#8221;PasswordRequired&#8221; runat=&#8221;server&#8221; ControlToValidate=&#8221;Password&#8221; ErrorMessage=&#8221;Password is required.&#8221; ToolTip=&#8221;Password is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,16],"tags":[19,20,21],"class_list":["post-188","post","type-post","status-publish","format-standard","hentry","category-applications","category-net","tag-asp-net","tag-login","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/188"}],"collection":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/comments?post=188"}],"version-history":[{"count":74,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":444,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/188\/revisions\/444"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}