当前位置: 首页 > news >正文

三网合一网站建设全包费用制作网页用的最多的图像文件格式

三网合一网站建设全包费用,制作网页用的最多的图像文件格式,十大黄金软件app免费,网络售后服务这周末也没干啥#xff0c;真正开始ASP#xff0c;做了个学籍管理系统的登录界面#xff0c;登录界面主要包括用户名、密码、验证码#xff0c;界面字体用了font size5 colorblue font-family:华文琥珀;/font改变字体…这周末也没干啥真正开始ASP做了个学籍管理系统的登录界面登录界面主要包括用户名、密码、验证码界面字体用了font size5 colorblue font-family:华文琥珀;/font改变字体生成验证码控件 ImageButton  例如asp:ImageButton IDImageButton1 runatserver / 还学会了图片按钮 HyperLink 例如 asp:HyperLink  IDHyperLink1 runatserver Textlink to Default NavigateUrl~/Default.aspx ImageUrl~/Image/1.gif/asp:HyperLink其中我觉得很难的就是验证码的生成你首先在站点中添加pivture.aspx 的窗体打开代码页面(即pivture.aspx.cs)并录入下面代码完整的Code 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;using System.Drawing;using System.IO; public partial class Picture : System.Web.UI.Page{    Random ran new Random();    protected void Page_Load(object sender, EventArgs e)    {        string str getRandomValidate(4);        Session[CheckCode] str;//这一部是Wie了验证码写入Session,进行验证也可以使用cookie        getImageValidate(str);       }    //得到随机字符串长度自定义    private string getRandomValidate(int len)    {        int num;        int tem;        string rtuStr;        for (int i 0; i len;i )        {            num ran.Next();            tem num % 10 0;//生成数字            //tem num % 26 A;//生成字符            rtuStr Convert.ToChar(tem).ToString();         }        return rtuStr;    }    //生成图像    private void getImageValidate(string strValue)    {         //string stroo00;前两个为字母o后两个数为0         int width Convert.ToInt32(strValue.Length*12);        Bitmap img new Bitmap(width,23);        Graphics gfc Graphics.FromImage(img);        gfc.Clear(Color.White);        drawLine(gfc,img);        //写验证码要定义Font        Font font new Font(arial,12,FontStyle.Bold);        //Font font new Font(宋体,12,FontStyle.Bold|FontStyle.Italic);        System.Drawing.Drawing2D.LinearGradientBrush brush new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0,0,img.Width,img.Height),Color.DarkOrchid,Color.Blue,1.5f,true);        gfc.DrawString(strValue,font, brush ,3,2);        drawPoint(img);        gfc.DrawRectangle(new Pen(Color.DarkBlue),0,0,img.Width-1,img.Height-1);        //将图像添加到页面        MemoryStream ms new MemoryStream();        img.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);        //更改HTTP        Response.ClearContent();        Response.ContentType image/gif;        Response.BinaryWrite(ms.ToArray());        //Dispose        gfc.Dispose();        img.Dispose();        Response.End();     }     private void drawLine(Graphics gfc,Bitmap img)    {        //选择画10条线也可以增加也可以不要线只要随机杂点就行        for (int i 0; i 10;i )        {            int x1 ran.Next(img.Width);            int y1 ran.Next(img.Height);            int x2 ran.Next(img.Width);            int y2 ran.Next(img.Height);            gfc.DrawLine(new Pen(Color.Silver),x1,y1,x2,y2);//注意画笔要淡不然看不清        }     }     //private void drawPoint(Bitmap img)    //{         //}     private void drawPoint(Bitmap img)    {        int col ran.Next();//在一次的图片中杂点颜色相同        for (int i 0; i 100; i)        {            int x ran.Next(img.Width);            int y ran.Next(img.Height);            img.SetPixel(x,y,Color.FromArgb(col));        }    }   }录完后需要在 登录界面显示验证码则需要在登录界面的代码文件 Page_Load 中加入  ImageButton1.ImageUrl ~/Picture.aspx;其登陆页面的代码Default.aspx.cs中的代码为Codeusing System;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;public partial class _Default : System.Web.UI.Page {    protected void Page_Load(object sender, EventArgs e)    {        ImageButton1.ImageUrl  ~/Picture.aspx;        if (Session[CheckCode]  null)            Information.Text  对不起验证码生成错误;    }    protected void OK_Click(object sender, EventArgs e)    {        if (UserName.Text.Length  0)            Information.Text  请输入用户名;        else        {            if(Password.Text.Length 0)                Information.Text  请输入密码;            else if (CheckCode.Text.ToString() ! Session[CheckCode].ToString())            {                Information.Text  对不起验证码不正确请重新输入;            }            else if (UserName.Text  Admin  Password.Text  Admin  CheckCode.Text.ToString()  Session[CheckCode].ToString())            {                Information.Text  用户  UserName.Text  登录成功;                Response.Redirect(~/Default2.aspx);            }            else                Information.Text  用户不存在或密码不正确;        }    }    protected void Cancel_Click(object sender, EventArgs e)    {        Information.Text  已退出登录 ;    }}转载于:https://www.cnblogs.com/yoyiorlee/archive/2009/09/20/1570631.html
http://www.zqtcl.cn/news/160219/

相关文章:

  • 营销型网站建设推荐google关键词
  • 网站上线是前端还是后端来做如何做垂直门户网站
  • 网站建设与管理2018海尔集团网站 建设目的
  • ps做网站大小wordpress调用 php文件
  • php网站忘记后台密码江苏网页制作报价
  • 网站模板 哪个好完备的常州网站推广
  • 衡水淘宝的网站建设濮阳市城乡一体化示范区主任
  • 公司网上注册在哪个网站商洛市商南县城乡建设局网站
  • 怎么才能让网站图文展示大连网站建设设计
  • 俱乐部网站 模板seo产品是什么意思
  • 新手学做网站的教学书建造师查询官网
  • win2012 iis添加网站群辉做网站服务器
  • 网站优化课程培训山东网站备案公司
  • top wang域名做网站好事业单位门户网站建设评价
  • 有什么网站可以做简历网站备案表格
  • 网站开发用什么图片格式最好厦门人才网个人会员
  • 关于网站开发的文献深圳网络推广代运营
  • 网站做app的重要性做静态网站有什么用
  • 一键搭建网站系统教做衣服的网站有哪些
  • 城乡建设部网站施工员证书查询中铁建设集团有限公司招标平台
  • 广东省建设项目安全标准自评网站哪个网站可以免费做简历
  • 带产品展示的个人网站模板购物网站开发背景
  • 哪个域名注册网站好seo广告投放是什么意思
  • 网站建设ydwzjs电子邮箱怎么申请
  • 福建省建住房建设部网站wordpress 算数验证码
  • 东莞企业如何建网站网站正在建设中...为什么护卫神
  • 引流用的电影网站怎么做wordpress浏览速度
  • 微信小程序怎拼做搬家网站东莞建网站公司
  • 网站推广昔年下拉博客推广链接制作软件
  • php 小企业网站 cmswordpress导航分类