Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 验证(ASP.net):属性';占位符';不是元素的有效属性';文本框';_C#_Asp.net - Fatal编程技术网

C# 验证(ASP.net):属性';占位符';不是元素的有效属性';文本框';

C# 验证(ASP.net):属性';占位符';不是元素的有效属性';文本框';,c#,asp.net,C#,Asp.net,自从我在注册页面中运行web应用程序以来,我一直收到占位符错误。我还试图清理类页面中的数据。下面是我的布局页面和类页面代码。我可以知道密码有什么问题吗 布局 <%@ Page Title="" Language="C#" MasterPageFile="~/TopJobAgency.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="TopJobAgencyApp.Register" %> &

自从我在注册页面中运行web应用程序以来,我一直收到占位符错误。我还试图清理类页面中的数据。下面是我的布局页面和类页面代码。我可以知道密码有什么问题吗

布局

<%@ 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);

        }
    }
}

由本网站设置,包括我们的Cookie使用。


× 条款与条件 本网站的使用须遵守以下使用条款:

本网站页面内容仅供您参考和使用。如有更改,恕不另行通知。
此网站使用Cookie监视浏览首选项。如果您允许使用cookies,我们可能会存储以下个人信息供第三方使用:[插入信息列表]。
我们或任何第三方均不对本网站上为任何特定目的而提供的信息和材料的准确性、及时性、性能、完整性或适用性提供任何担保或保证。您承认此类信息和材料可能包含不准确或错误,我们在法律允许的最大范围内明确排除对任何此类不准确或错误的责任。
您使用本网站上的任何信息或材料的风险完全由您自行承担,对此我们不承担任何责任。您应自行负责确保通过本网站提供的任何产品、服务或信息符合您的具体要求。
本网站包含由我们拥有或授权给我们的资料。该材料包括但不限于设计、布局、外观、外观和图形。除版权声明外,禁止复制,版权声明构成本条款和条件的一部分。
本网站上转载的所有商标,如果不是运营商的财产或许可给运营商,则在本网站上予以确认。
未经授权使用本网站可能导致索赔和/或刑事犯罪。
本网站还可能不时包含指向其他网站的链接。提供这些链接是为了方便您提供更多信息。它们并不意味着我们认可该网站。我们对链接网站的内容不承担任何责任。 您对本网站的使用以及由此产生的任何争议均受新加坡、淡马锡理工学院和第一集团的法律管辖。 阶级 使用制度; 使用System.Collections.Generic; 使用System.Linq; 使用System.Text.RegularExpressions; 使用System.Web; 使用System.Web.UI; 使用System.Web.UI.WebControl; 使用TopJobAgencyApp.Class; 命名空间TopJobAgencyApp { 公共部分类注册:System.Web.UI.Page { 受保护的无效页面加载(对象发送方、事件参数e) { } 受保护的无效btnLogin\U单击(对象发送方,事件参数e) { 重定向(“Login.aspx?”); } 受保护的无效BTN注册表\u Click1(对象发送者,事件参数e) { 字符串user=tbxDisplayname.Text; 字符串email=tbxEmailaddress.Text; 字符串pw=tbxPw.Text; 字符串querystring=“username=”+用户; querystring+=“&”+“email=“+email; 查询字符串+=”&“+”密码=“+pw; 消毒(用户); 消毒(电子邮件); 消毒; 注册u=新注册(tbxDisplayname.Text、tbxemaildAddress.Text、tbxPw.Text); DBManager.InsertLogin(u); 重定向(“Login.aspx?”); } 受保护的无效btnBack\u单击(对象发送者,事件参数e) { 重定向(“Home.aspx?”); } 公共字符串清理(字符串stringValue) { if(null==stringValue) { 返回字符串值; } 其他的 { 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); 返回字符串值; } } 私有字符串RegexReplace(字符串stringValue、字符串匹配模式、字符串替换) { 返回Regex.Replace(stringValue、matchPattern、toReplaceWith); } 私有字符串RegexReplace(字符串stringValue、字符串匹配模式、字符串替换、RegexOptions RegexOptions) { 返回Regex.Replace(stringValue、matchPattern、torereplacewith、regexOptions); } } }
textbox服务器控件没有占位符属性。文本框不支持它,并且在您尝试设置它时将生成错误,因为没有属性。你可以