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 %>
相关文档:
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:背景色
......
文 / 李博(光宇广贞)
方法多态与类型多态
了解 OOP 的同学对类型多态都很熟悉了。话说,类型多态之多态便体现在方法上,那方法多态又是嘛玩儿?类型多态之类型指的是对像的类型,其方法是受对像约束的。方法多态便是不受对像类型约束的多态。具体区别在:
方法多态无需继承 ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using  ......
asp.net窗体的打开和关闭
//打开新的窗体
Response.Redirect("WebMain.aspx");
//弹出一个新窗体
Response.Write("<script>window.open(\"WebMain.aspx\")</script>")
//弹出一个只有确定按钮的提示框
Response.Write("<script>alert(\"用户名或密码错误\");</script>") ......