step 1
download dll mscaptcha to my computer
step 2
Add references from mscaptcha.dll file
step 3
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
in aspx file
step 4
<div>
<cc1:CaptchaControl ID="Captcha1" runat="server"
CaptchaBackgroundNoise="Low" CaptchaLength="5"
CaptchaHeight="60" CaptchaWidth="200"
CaptchaLineNoise="None" CaptchaMinTimeout="5"
CaptchaMaxTimeout="240" FontColor = "#529E00" />
</div>
<asp:TextBox ID="txtCaptcha" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<asp:Label ID="lblMessage" runat="server" Text="lblMessage"></asp:Label>
input to the aspx file
step 5
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim());
if (Captcha1.UserValidated)
{
lblMessage.ForeColor = System.Drawing.Color.Green;
lblMessage.Text = "Valid";
}
else
{
lblMessage.ForeColor = System.Drawing.Color.Red;
lblMessage.Text = "InValid";
}
}
catch
{
Page_Load(sender,e);
}
}
input to cs file
วันศุกร์ที่ 30 พฤษภาคม พ.ศ. 2557
วันพุธที่ 28 พฤษภาคม พ.ศ. 2557
get folder structure asp.net c#
step 1 using System.IO;
step 2
Create Button and traeeview on design view.
step3 create function on cs file.
protected void Button1_Click(object sender, EventArgs e)
{
Listdirectory(TreeView1,"D:\\program");
}
private void Listdirectory(TreeView treeview,string part)
{
treeview.Nodes.Clear();
var rootdirectoryinfo = new DirectoryInfo(part);
treeview.Nodes.Add(Createdirtolynode(rootdirectoryinfo));
}
private static TreeNode Createdirtolynode(DirectoryInfo directory)
{
var directorynote = new TreeNode(directory.Name);
foreach (var direc in directory.GetDirectories())
{
directorynote.ChildNodes.Add(Createdirtolynode(direc));
}
foreach (var file in directory.GetFiles())
{
directorynote.ChildNodes.Add(new TreeNode(file.Name));
}
return directorynote;
}
step 2
Create Button and traeeview on design view.
step3 create function on cs file.
protected void Button1_Click(object sender, EventArgs e)
{
Listdirectory(TreeView1,"D:\\program");
}
private void Listdirectory(TreeView treeview,string part)
{
treeview.Nodes.Clear();
var rootdirectoryinfo = new DirectoryInfo(part);
treeview.Nodes.Add(Createdirtolynode(rootdirectoryinfo));
}
private static TreeNode Createdirtolynode(DirectoryInfo directory)
{
var directorynote = new TreeNode(directory.Name);
foreach (var direc in directory.GetDirectories())
{
directorynote.ChildNodes.Add(Createdirtolynode(direc));
}
foreach (var file in directory.GetFiles())
{
directorynote.ChildNodes.Add(new TreeNode(file.Name));
}
return directorynote;
}
วันจันทร์ที่ 19 พฤษภาคม พ.ศ. 2557
Edit file web configuration
step 1
using System.Web.Configuration;
using System.Configuration;
step 2
var configuration = WebConfigurationManager.OpenWebConfiguration("~");
Find file the web config.
var section = (ConnectionStringsSection)configuration.GetSection("connectionStrings");
select tax for editor.
section.ConnectionStrings["MyConnectionString"].ConnectionString = "Data Source=...";
Edit name tax.
configuration.Save();
save file web config.
using System.Web.Configuration;
using System.Configuration;
step 2
var configuration = WebConfigurationManager.OpenWebConfiguration("~");
Find file the web config.
var section = (ConnectionStringsSection)configuration.GetSection("connectionStrings");
select tax for editor.
section.ConnectionStrings["MyConnectionString"].ConnectionString = "Data Source=...";
Edit name tax.
configuration.Save();
save file web config.
สมัครสมาชิก:
บทความ (Atom)