C# ASP.NET 获取脚本语句并用文本的方式显示出来
protected void Button6_Click(object sender, EventArgs e)
{
this.Label11.Text = HtmlEncode(this.TextBox3.Text);
}
protected static string HtmlEncode(string the)
{
the = the.Replace("<", "<");
the = the.Replace(" ", " ");
the = the.Replace("\"", """);
the = the.Replace("\'", "'");
the = the.Replace("\n", "<br/> ");
return the;
}
通过在 Page 指令或 配置节中设置 validateRequest=false
就是在页面中加入
<%@page validateRequest=false %>
相关文档:
法一:调用winrar
using Microsoft.Win32;
using System.Diagnostics;
protected void Button1_Click(object sender, EventArgs e)
{
RAR(@"E:\95413594531\GIS", "tmptest", @"E:\95413594531\");
}
/// ......
public static Boolean WriteTextFile(string content, string filepath,string name)
{
FileStream fs;
StreamWriter sw;
if (!System.IO.Directory.Exists(filepath))
{
DirectoryInfo DirInfo = Directory.CreateDirectory(filepath); //创建目录
DirI ......
Label——height:高度
width:宽度
backcolor:背景色
......
asp.net窗体的打开和关闭
//打开新的窗体
Response.Redirect("WebMain.aspx");
//弹出一个新窗体
Response.Write("<script>window.open(\"WebMain.aspx\")</script>")
//弹出一个只有确定按钮的提示框
Response.Write("<script>alert(\"用户名或密码错误\");</script>") ......