http://chs.gotdotnet.com/quickstart/aspplus/doc/formsauth.aspx

解决方案 »

  1.   

    用随机函数产生一组随机数。后台记录这个数,放到一个hidden框中,然后再提供一个输入随机数的地方。用户提交的时候,对比hidden框和textbox框的内容,如果一样就允许文章添加。不同报错。
      

  2.   

    放一个小标签,然后在后台的page_Load里写:
    System.Random rd=new System.Random();
    Label1.Text=rd.Next(1000000,9999999).ToString();
    登陆时做比较就行了
    记得给分哦:)
      

  3.   

    一般是提交到服务器进行验证!自己写验证代码验证数据库中信息或者把用户信息存储再web.config文件中进行判断!
    大部分进行验证后都回传cookie,以后的验证就用cookie来做了。
      

  4.   

    请参阅:
    http://www.wrclub.net/study/listarticle.aspx?id=1525
    我还没有去实现呢,不知道可不可以。我想应该可以的吧。你试试。
      

  5.   

    一般是一个图片,然后再将生成的验证码保存到session或cookie 当中演示L http://www.cnblogs.com/zc_net/archive/2004/03/09/2606.aspx下午无聊,看了网友的在内存在生成图像然后在前台中显示出来的文章。发现跟以前我写的一个大图生成小图的有许多相似的地方,也许。NET的图像操作都是差不多的吧。都是调用 Imports System.Drawing.Imaging,Imports System.Drawing.Drawing2D.下面是我写的代码。大家看看
    webform1.aspx Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Image1.ImageUrl = "default.aspx?number=" + TextBox1.Text
        End Sub default.aspx
     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            '在此处放置初始化页的用户代码
            Dim strimage As String = Request.QueryString("number")
            If Not strimage Is Nothing Then
                Response.Clear()
                Dim image_widht As Integer = 50
                Dim image_height As Integer = 20
                Dim image_size As New Size
                image_size = New Size(image_widht, image_height)
                Dim bit As Bitmap = New Bitmap(image_size.Width, image_size.Height, PixelFormat.Format24bppRgb)
                Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bit)
                g.SmoothingMode = SmoothingMode.AntiAlias
                g.Clear(Color.FromArgb(255, 255, 255)) '背景颜色!
                g.DrawRectangle(Pens.WhiteSmoke, 0, 0, image_size.Width, image_size.Height)
                g.DrawString(strimage, New Font("Arial", 10), New SolidBrush(Color.FromArgb(0, 125, 0)), New PointF(0, 0)) '显示数字,颜色为0.125.0
                bit.Save(Response.OutputStream, ImageFormat.Gif)
                g.Dispose()
                bit.Dispose()
                Response.End()
            End If
        End Sub 
      

  6.   

    随机数字直接生成图片的ASP代码  
    来源: 经典论坛   作者: 张三疯  
    随机数字直接生成图片的ASP代码,可以做认证码。
    xbm.asp
    <!--#include file="numcode.asp"-->
    <%
    Response.Buffer = True
    With Response
    .Expires = -1
    .AddHeader "Pragma","no-cache"
    .AddHeader "cache-ctrol","no-cache"
    End WithDim num
    Randomize
    num = Int(7999 * Rnd + 2000)
    Session("validateCode") = numDim Image
    Dim Width, Height
    Dim digtal
    Dim Length
    Dim sort
    Dim hc
    Length = 4 
    hc = chr(13) & chr(10)Redim sort(Length)digital = ""
    For I = 1 To Length - Len(num)
    digital = digital & "0"
    Next
    For I = 1 To Len(num)
    digital = digital & Mid(num, I, 1)
    Next
    For I = 1 To Len(digital)
    sort(I) = Mid(digital, I, 1)
    Next
    Width = 8 * Len(digital)
    Height = 10Response.ContentType = "image/x-xbitmap"Image = "#define counter_width " & Width & hc
    Image = Image & "#define counter_height " & Height & hc
    Image = Image & "static unsigned char counter_bits[] = {" & hcFor I = 1 To Height
    For J = 1 To Length
    Image = Image & a(sort(J),I) & ","
    Next
    NextImage = Left(Image, Len(Image) - 1)
    Image = Image & "};" & hcResponse.Write Image
    %>numcode.asp
    <%
    Dim a(10,10)a(0,1) = "0x3c" '数字0
    a(0,2) = "0x66"
    a(0,3) = "0xc3"
    a(0,4) = "0xc3"
    a(0,5) = "0xc3"
    a(0,6) = "0xc3"
    a(0,7) = "0xc3"
    a(0,8) = "0xc3"
    a(0,9) = "0x66"
    a(0,10)= "0x3c"a(1,1) = "0x18" '数字1
    a(1,2) = "0x1c"
    a(1,3) = "0x18"
    a(1,4) = "0x18"
    a(1,5) = "0x18"
    a(1,6) = "0x18"
    a(1,7) = "0x18"
    a(1,8) = "0x18"
    a(1,9) = "0x18"
    a(0,10)= "0x7e"a(2,1) = "0x3c" '数字2
    a(2,2) = "0x66"
    a(2,3) = "0x60"
    a(2,4) = "0x60"
    a(2,5) = "0x30"
    a(2,6) = "0x18"
    a(2,7) = "0x0c"
    a(2,8) = "0x06"
    a(2,9) = "0x06"
    a(2,10)= "0x7e"a(3,1) = "0x3c" '数字3
    a(3,2) = "0x66"
    a(3,3) = "0xc0"
    a(3,4) = "0x60"
    a(3,5) = "0x1c"
    a(3,6) = "0x60"
    a(3,7) = "0xc0"
    a(3,8) = "0xc0"
    a(3,9) = "0x66"
    a(3,10)= "0x38"a(4,1) = "0x38" '数字4
    a(4,2) = "0x3c"
    a(4,3) = "0x36"
    a(4,4) = "0x33"
    a(4,5) = "0x33"
    a(4,6) = "0x33"
    a(4,7) = "0xff"
    a(4,8) = "0x30"
    a(4,9) = "0x30"
    a(4,10)= "0xfe"a(5,1) = "0xfe" '数字5
    a(5,2) = "0xfe"
    a(5,3) = "0x06"
    a(5,4) = "0x06"
    a(5,5) = "0x3e"
    a(5,6) = "0x60"
    a(5,7) = "0xc0"
    a(5,8) = "0xc3"
    a(5,9) = "0x66"
    a(5,10)= "0x3c"a(6,1) = "0x60" '数字6
    a(6,2) = "0x30"
    a(6,3) = "0x18"
    a(6,4) = "0x0c"
    a(6,5) = "0x3e"
    a(6,6) = "0x63"
    a(6,7) = "0xc3"
    a(6,8) = "0xc3"
    a(6,9) = "0x66"
    a(6,10) ="0x3c"a(7,1) = "0xff" '数字7
    a(7,2) = "0xc0"
    a(7,3) = "0x60"
    a(7,4) = "0x30"
    a(7,5) = "0x18"
    a(7,6) = "0x18"
    a(7,7) = "0x18"
    a(7,8) = "0x18"
    a(7,9) = "0x18"
    a(7,10)= "0x18"a(8,1) = "0x3c" '数字8
    a(8,2) = "0x66"
    a(8,3) = "0xc3"
    a(8,4) = "0x66"
    a(8,5) = "0x3c"
    a(8,6) = "0x66"
    a(8,7) = "0xc3"
    a(8,8) = "0xc3"
    a(8,9) = "0x66"
    a(8,10)= "0x3c"a(9,1) = "0x3c" '数字9
    a(9,2) = "0x66"
    a(9,3) = "0xc3"
    a(9,4) = "0xc3"
    a(9,5) = "0x66"
    a(9,6) = "0x3c"
    a(9,7) = "0x18"
    a(9,8) = "0x0c"
    a(9,9) = "0x06"
    a(9,10)= "0x03"
    %>引用时,和插入图片一样
    <img src="xbm.asp"> 
     
     
      

  7.   

    menuvb,你写的东西我试过了,确实可行,谢谢,但是还有一个问题请教,如果用户点浏览器的后退按钮,验证码怎样可以改变?
      

  8.   

    在窗体传回服务器时加入menuvb写的东西