Asp.net POST Form Data to Another Page

Posted by Unknown On Thursday, January 22, 2015 0 comments
Problem: I have a login form written in Asp.net code. I want to post my username and password to authentication.aspx page to verify this user, but I cannot use action link in form because it is used by other button too.

Solutions: use postbackurl property in Asp.net Button.

ASP.NET Page
<asp:Button OnClientClick="if(!validateLogin()) return false;" 
     PostBackUrl="~/Account/authentication.aspx" Text="Sign in" runat="server" ID="butLogin" />

Note: if you want to validate the form before posting data, you need to do the same way ask I do. It won't work if you use:
OnClientClick="return validateLogin();"

0 comments:

Post a Comment