就安全问题而言,CAPTCHA做了什么?很多网站的注册表都有这个领域,但它是如何运作的?
我使用了必需的字段验证器,后跟一个正则表达式验证器,但是必需的字段验证器不工作.....
<asp:TextBox ID="txtSummary" runat="server" TextMode="MultiLine" Width="700px"
CssClass="txtStyle" Font-Names="Arial" MaxLength="1000"
ValidationGroup="Valtxt" TabIndex="2" Rows="4">
</asp:TextBox>
<asp:RegularExpressionValidator ID="regValSummary" runat="server"
ControlToValidate="txtSummary" Display="Dynamic"
ValidationExpression="[^<>&#!]*" ValidationGroup="Valtxt">
Invalid characters(<>&#!) are not allowed
</asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="reqvalSummary" runat="server"
ControlToValidate="txtSummary" ErrorMessage="Summary is required"
ValidationGroup="Valtxt" Display="Dynamic">
</asp:RequiredFieldValidator>
Run Code Online (Sandbox Code Playgroud)
任何人都可以看到问题???
我编写了一组函数来验证表单中的文本框,以满足他们所需的字段需求
private void ValidateForm()
{
//Initialise the variables for validation check and call the related functions
bool bisValidhost = ValidateHost();
bool bisValidPassword = ValidatePassword();
bool bisUsername = ValidateUsername();
//If any of the entries is missing then show error message
if(bisValidhost && bisValidPassword && bisUsername == false)
{
MessageBox.Show("This is not a Valid Entry!");
}
}
/// <summary>
/// This function validate the Required field need of txtHost.
/// </summary>
/// <returns></returns>
private bool ValidateHost()
{
ErrorProvider errorProvider = new ErrorProvider(); …Run Code Online (Sandbox Code Playgroud) 我有这样的代码
private void btnStartAnalysis_Click(object sender, EventArgs e)
{
//Checks for the selectedItem in the cmbOpearions dropdown and make call to appropriate functions.
if((string) (cmbOperations.SelectedItem) == "PrimaryKeyTables")
{
//This is the function call for the primary key checking in DB
GetPrimaryKeyTable();
}
//Checks for the selectedItem in the cmbOpearions dropdown and make call to appropriate functions.
if((string) (cmbOperations.SelectedItem) == "NonPrimaryKeyTables")
{
//This is the function call for the nonPrimary key checking in DB
GetNonPrimaryKeyTables();
}
//Checks for the selectedItem in the …Run Code Online (Sandbox Code Playgroud) 我有一个这样的函数,它检查字段是否为空或什么,如果为空,然后在文本框旁边获取setError图标.
private bool ValidateHost()
{
ErrorProvider errorProvider = new ErrorProvider();
bool isValid = true;
//If the txtHost is empty, show a message to user
if(txtHost.Text == string.Empty)
{
errorProvider.SetError(txtHost, "Please enter the host address");
isValid = false;
}
else
errorProvider.SetError(txtHost, string.Empty);
return isValid;
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用字符串时,isnullorempty然后我没有得到seterror图标..你们可以告诉我在这种情况下使用string.isnullorempty的正确方法是什么..
我开发了一个表单,从用户获取用户ID和密码,并显示本地服务器中可用的数据库列表.现在我已经用硬编码格式完成了...像这样
public void BindDBDropDown()
{
//Create the connection object
SqlConnection sConnection = new SqlConnection(
ConfigurationSettings.AppSettings["ConnectionString"]);
//To Open the connection.
sConnection.Open();
//Query to select the list of databases.
string selectDatabaseNames =
@"SELECT NAME FROM MASTER..SYSDATABASES";
//Create the command object
SqlCommand sCommand =
new SqlCommand(selectDatabaseNames, sConnection);
try
{
//Create the data set
DataSet sDataset = new DataSet("master..sysdatabases");
//Create the dataadapter object
SqlDataAdapter sDataAdapter =
new SqlDataAdapter(selectDatabaseNames, sConnection);
sDataAdapter.TableMappings.Add("Table",
"master..sysdatabases");
//Fill the dataset
sDataAdapter.Fill(sDataset);
//Bind the database names in combobox
DataViewManager dsv = …Run Code Online (Sandbox Code Playgroud) 我有这样的功能
public void GetTablesWithUpperCaseName()
{
SqlConnectionStringBuilder objConnectionString = new SqlConnectionStringBuilder();
objConnectionString.DataSource = txtHost.Text;
objConnectionString.UserID = txtUsername.Text;
objConnectionString.Password = txtPassword.Text;
objConnectionString.InitialCatalog = Convert.ToString(cmbDatabases.SelectedValue);
SqlConnection sConnection = new SqlConnection(objConnectionString.ConnectionString);
//To Open the connection.
sConnection.Open();
//Query to select table_names that have their names in uppercase letters.
string selectTablesWithUppercaseName = @"SELECT
NAME
FROM
sysobjects
WHERE
UPPER(name) COLLATE Latin1_General_BIN = name COLLATE Latin1_General_BIN
AND
OBJECTPROPERTY(ID,N'IsTable')=1
AND
OBJECTPROPERTY(ID,N'IsMSShipped')=0 ";
//Create the command object
SqlCommand sCommand = new SqlCommand(selectTablesWithUppercaseName, sConnection);
try
{
//Create the dataset
DataSet dsListOfTablesWithUppercaseName …Run Code Online (Sandbox Code Playgroud) 是否有任何查询,以便我可以获取表的列表,其中包含本地服务器上所选数据库的每个表中的列数.
如果有的话请转发你的想法......
我有这样的span元素
<span id="yui-gen56" class="ir i-doc" style="background-color: transparent;"></span>
Run Code Online (Sandbox Code Playgroud)
现在我想检索类属性值,以便它返回我ir i-doc进行验证.知道如何获取此属性值以进一步验证.
提前致谢
c# ×6
winforms ×5
asp.net ×3
sql ×2
sql-server ×2
.net ×1
asp.net-mvc ×1
automation ×1
java ×1
security ×1
t-sql ×1
validation ×1