using 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.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Bitmap image = new Bitmap(100, 50);
Graphics graphics = Graphics.FromImage(image);
graphics.Clear(Color.Black);
Font font = new Font("宋体", 16);
Brush brush = new SolidBrush(Color.White);
graphics.DrawString("多少", font, brush, 0, 0);
graphics.Dispose();
Response.Clear();
Response.ContentType = "image/pjepg";
image.Save(Response.OutputStream, ImageFormat.Jpeg);
image.Dispose();
Response.End();
}
}
运行之后出现:
无法显示 XML 页。
使用 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。
--------------------------------------------------------------------------------文本内容中发现无效字符。处理资源 'http://localhost:1788/WebSite6/Default.aspx' 时出错。
这个是什么意思啊
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.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Bitmap image = new Bitmap(100, 50);
Graphics graphics = Graphics.FromImage(image);
graphics.Clear(Color.Black);
Font font = new Font("宋体", 16);
Brush brush = new SolidBrush(Color.White);
graphics.DrawString("多少", font, brush, 0, 0);
graphics.Dispose();
Response.Clear();
Response.ContentType = "image/pjepg";
image.Save(Response.OutputStream, ImageFormat.Jpeg);
image.Dispose();
Response.End();
}
}
运行之后出现:
无法显示 XML 页。
使用 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。
--------------------------------------------------------------------------------文本内容中发现无效字符。处理资源 'http://localhost:1788/WebSite6/Default.aspx' 时出错。
这个是什么意思啊
function change()
{
var img =document.getElementById("ImageButton1");
img.src=img.src+"?";
}
</script>
<a href="javascript:change();">看不清,换一张 </a> <img alt="" src="" style="cursor:pointer;" id="codeimg" onclick="this.src='validate.aspx?time=' + Math.random();" /> <script language="javascript" type="text/javascript">document.getElementById('codeimg').src = 'validate.aspx?time=' + Math.random(); </script>
{
checkCode = " ";
}
else
{ checkCode = Server.UrlDecode(Request.QueryString["str"].ToString() == "" ? "" : Request.QueryString["str"].ToString);
}
Bitmap image = new Bitmap((int)Math.Ceiling((100.00)), 22);
Graphics g = Graphics.FromImage(image); try
{
//生成随机生成器
Random random = new Random();
//清空图片背景色
g.Clear(Color.White);
//Font font = new System.Drawing.Font("宋体", 10, (System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic));
//System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Black, Color.Black,90, true);
//g.DrawString(checkCode, font, brush, 2, 2);
g.FillRectangle(new System.Drawing.SolidBrush(Color.Black), 0, 0, image.Width, 20);
g.Clear(Color.White);
g.DrawString(checkCode, new Font("宋体", 10, FontStyle.Bold), Brushes.Black, new PointF(5, 5));
System.IO.MemoryStream ms = new System.IO.MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/Gif";
Response.BinaryWrite(ms.ToArray());
}
finally
{
g.Dispose();
image.Dispose();
}