由于我在注册页面中运行Web应用程序,因此一直收到占位符错误。我也试图在类页面中清理数据。下面是我的布局页面和类页面的代码。我可以知道代码有什么问题吗?
LAYOUT
<%@ Page Title="" Language="C#" MasterPageFile="~/TopJobAgency.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="TopJobAgencyApp.Register" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="/css/Register.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="container">
<br />
<br />
<br />
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form id="form1" runat="server">
<h2>Please Sign Up <small>It's free and always will be.</small></h2>
<hr class="colorgraph">
<div class="form-group">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:TextBox ID="tbxDisplayname" Cssclass="form-control input-lg" placeholder="Username" runat="server"></asp:TextBox>
</div>
<div class="form-group">
<asp:TextBox ID="tbxEmailaddress" Cssclass="form-control input-lg" placeholder="Email Address" runat="server"></asp:TextBox>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<asp:TextBox ID="tbxPw" Cssclass="form-control" placeholder="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:PasswordStrength ID="tbxPw_PasswordStrength" runat="server" TargetControlID="tbxPw">
</asp:PasswordStrength>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<asp:TextBox ID="tbxCfmpw" Cssclass="form-control" placeholder="Retype Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:PasswordStrength ID="tbxCfmpw_PasswordStrength" runat="server" TargetControlID="tbxCfmpw">
</asp:PasswordStrength>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
</div>
<div class="col-xs-8 col-sm-9 col-md-9">
By clicking <strong class="label label-primary">Register</strong>, you agree to the <a href="#" data-toggle="modal" data-target="#t_and_c_m">Terms and Conditions</a> set out by this site, including our Cookie Use.
</div>
</div>
<hr class="colorgraph">
<div class="row">
<div class="col-xs-12 col-md-6">
<asp:Button ID="btnRegister" runat="server" Cssclass="btn btn-primary btn-block" Text="Register" OnClick="btnRegister_Click1" />
</div>
<div class="col-xs-12 col-md-6">
<asp:Button ID="btnBack" runat="server" Cssclass="btn btn-default btn-block" Text="Back" OnClick="btnBack_Click" />
</div>
<br />
</div>
</form>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="t_and_c_m" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Terms & Conditions</h4>
</div>
<div class="modal-body">
The use of this website is subject to the following terms of use:
<br /><br />
The content of the pages of this website is for your general information and use only. It is subject to change without notice.<br />
This website uses cookies to monitor browsing preferences. If you do allow cookies to be used, the following personal information may be stored by us for use by third parties: [insert list of information].<br />
Neither we nor any third parties provide any warranty or guarantee as to the accuracy, timeliness, performance, completeness or suitability of the information and materials found or offered on this website for any particular purpose. You acknowledge that such information and materials may contain inaccuracies or errors and we expressly exclude liability for any such inaccuracies or errors to the fullest extent permitted by law.<br />
Your use of any information or materials on this website is entirely at your own risk, for which we shall not be liable. It shall be your own responsibility to ensure that any products, services or information available through this website meet your specific requirements.<br />
This website contains material which is owned by or licensed to us. This material includes, but is not limited to, the design, layout, look, appearance and graphics. Reproduction is prohibited other than in accordance with the copyright notice, which forms part of these terms and conditions.<br />
All trade marks reproduced in this website which are not the property of, or licensed to, the operator are acknowledged on the website.<br />
Unauthorised use of this website may give rise to a claim for damages and/or be a criminal offence.<br />
From time to time this website may also include links to other websites. These links are provided for your convenience to provide further information. They do not signify that we endorse the website(s). We have no responsibility for the content of the linked website(s).
Your use of this website and any dispute arising out of such use of the website is subject to the laws of Singapore, Temasek Polytechnic and Group 1.
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</div>
</asp:Content>
CLASS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TopJobAgencyApp.Class;
namespace TopJobAgencyApp
{
public partial class Register : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnLogin_Click(object sender, EventArgs e)
{
Response.Redirect("Login.aspx?");
}
protected void btnRegister_Click1(object sender, EventArgs e)
{
string user = tbxDisplayname.Text;
string email = tbxEmailaddress.Text;
string pw = tbxPw.Text;
string querystring = "username=" + user;
querystring += "&" + "email=" + email;
querystring += "&" + "password=" + pw;
Sanitize(user);
Sanitize(email);
Sanitize(pw);
Registration u = new Registration(tbxDisplayname.Text, tbxEmailaddress.Text, tbxPw.Text);
DBManager.InsertLogin(u);
Response.Redirect("Login.aspx?");
}
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Redirect("Home.aspx?");
}
public string Sanitize(string stringValue)
{
if (null == stringValue)
{
return stringValue;
}
else
{
RegexReplace(stringValue, "-{2,}", "_");
RegexReplace(stringValue, @"(;|\s)(exec|execute|select|insert|update|delete|create|alter|drop|rename|truncate|backup|restore)\s", string.Empty, RegexOptions.IgnoreCase);
RegexReplace(stringValue, "_", string.Empty);
RegexReplace(stringValue, @"[*/]+", string.Empty);
return stringValue;
}
}
private string RegexReplace(string stringValue, string matchPattern, string toReplaceWith)
{
return Regex.Replace(stringValue, matchPattern, toReplaceWith);
}
private string RegexReplace(string stringValue, string matchPattern, string toReplaceWith, RegexOptions regexOptions)
{
return Regex.Replace(stringValue, matchPattern, toReplaceWith, regexOptions);
}
}
}