Solved

ASP .net  Escape page validation

Posted on 2004-10-13
5
312 Views
Last Modified: 2010-04-06
Dear experts,

I have a renew password web form. As the name says, it renews user password.
 
In which, there are web contorls such as new password textbox and confirm password textbox  that are validated by validation controls. For example, if the password textboxes are empty, it simply invalid the page.

The page also has a hyperlink button "Renew Later", for user to have an option to renew the account at a later time. Once user click on the hyperlink button, it redirect user to some other page.

The problem with this set up is if the user just click on the hyperlink button "Renew Later" without entering password, it triggers the page validation control. Is there a simple way to escape the validation?

Thanks

etalexit
0
Comment
Question by:etalexit
  • 2
5 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12302494
We'll need to see code I think.

Cd&
0
 

Author Comment

by:etalexit
ID: 12302621
Below is the code sample.
When user click on the hyperlink button "Later", since there is no password entered, the validator invalide the page.
Is there a way to escape the validation when "Later" is clicked and call the code behind function Sub lnkCancel_Click in order to singout the user

---------------------------------------------------------------------------

renew.aspx

<html>
<body>
<form id="Form2" method="post" runat="server">
<asp:LinkButton id="lnkCancel" runat="server">Later</asp:LinkButton
<TABLE id="Renew" style="WIDTH: 374px; HEIGHT: 264px" width="374" align="center">
<TR>
      <TH bgColor="#b70000" colSpan="2">
            <FONT color="#ffffff">Renew Password</FONT></TH></TR>
<TR>
      <TD colSpan="2">User Name:</TD>
</TR>
<TR>
      <TD align="left" colSpan="2"><asp:textbox id="txtUNM" runat="server" ToolTip="Registered User Name" ForeColor="#400000" MaxLength="15"
                  Width="100%" BorderStyle="None" Enabled="False"></asp:textbox></TD>
</TR>
<TR>
      <td colSpan="2">Existing Password:</td>
</TR>
<tr>
      <td style="HEIGHT: 24px" align="left" colSpan="2"><asp:textbox id="txtOldPwd" runat="server" ToolTip="Existing Password" ForeColor="#400000" Width="100%"
                  TextMode="Password"></asp:textbox><asp:requiredfieldvalidator id="valExistingPwd" runat="server" ErrorMessage="**Please enter the existing password"
                  ControlToValidate="txtOldPwd"></asp:requiredfieldvalidator></td>
</tr>
<tr>
      <td colSpan="2">New Password:</td>
</tr>
<tr>
      <td style="HEIGHT: 53px" align="left" colSpan="2"><asp:textbox id="txtNewPwd" runat="server" ToolTip="New Password" ForeColor="#400000" Width="100%"
                  TextMode="Password"></asp:textbox><asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" ErrorMessage="**Invalid password combination"
                  ControlToValidate="txtNewPwd" ValidationExpression="(?=^.{8,20}$)((?=.*\d)(?=.*[A-Z]) (?=.*[a-z])(?!.*\s)|(?=.*\d)(?=.*[^A-Za-z0-9]) (?=.*[a-z])(?!.*\s)|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]) (?!.*\s)|(?!.*\s)(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*"> </asp:regularexpressionvalidator></td>
</tr>
<tr>
      <td colSpan="2">Confirm New Password:</td>
</tr>
<tr>
      <td style="HEIGHT: 24px" align="left" colSpan="2"><asp:textbox id="txtNewConfPwd" runat="server" ToolTip="Cofirm New Password" ForeColor="#400000"
                  Width="100%" TextMode="Password"></asp:textbox><asp:comparevalidator id="valNewConfPwd" runat="server" ErrorMessage="**Confirm password does not match  new password"
                  ControlToValidate="txtNewConfPwd" ControlToCompare="txtNewPwd"></asp:comparevalidator></td>
</tr>
<tr>
      <td class="bodyText" colSpan="2"></td>
</tr>
<tr>
      <td align="right" colSpan="2"><asp:button id="btnOK" runat="server" ToolTip="Reset Password. Password will be emailed to your account."
                  ForeColor="#400000" Width="36px" BorderStyle="Solid" BackColor="#FFC0C0" BorderColor="#400000" Text="OK"></asp:button></td>
</tr>
</TABLE>
</td>
</tr>
</table>
</form>
</html>
-----------------------------------------------------------------
renew.aspx.vb
    Private Sub lnkCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkCancel.Click
            FormsAuthentication.SignOut()
    End Sub


0
 

Author Comment

by:etalexit
ID: 12311435
Got it. The solution is really simple. Set the CauseValidation property = false.

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12577702
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
RSS Feed Validation 2 59
CSS HELP 6 84
use of cookies and regulations 1 76
Facebook React and SyntheticEvents 6 49
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now