asp.net验证码制作实例代码
效果图
Default.aspx页面的内容
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Verify._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<img src="viewImg.aspx" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
Default.aspx.cs页面的内容
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace Verify
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string text = this.TextBox1.Text.ToString();//获得用户输入的验证码
 
相关文档:
HttpContext.Current.Request.Url.ToString() 并不可靠。
如果当前URL为
http://localhost/search.aspx?user=http://csharp.xdowns.com&tag=%BC%BC%CA%F5
通过HttpContext.Current.Request.Url.ToString()获取到的却是
http://localhost/search.aspxuser=http://csharp.xdowns.com&tag=¼&fra ......
protected void Page_Load(object sender, EventArgs e)
{
}
#region OnPreInit 第一步
protected override void OnPreInit(EventArgs e)
{
//检查 ......
+++ 修改WebConfig文件:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="connStr" value="Data Source=ora11g;uid=scott;pwd=tiger;unicode=true"/>
</appSettings>
<connectionStrings>
<ad ......
参考 http://topic.csdn.net/t/20040510/19/3051316.html
开始
运行
dcomcnfg
组件服务一项中选择Dcom配置,找到Microsoft excel应用程序,察看属性
安全选项卡中,启动权限和访问权 ......
1、直接将页面内容存在变量中后输出:
StringBuilder IndexContentResult= new StringBuilder(); //存放输出页面的HTML
IndexContentResult.Append("<html>\n");
IndexContentResult.Append(&qu ......