日期:2014-04-26 浏览次数:22715 次
使用Server获取地址
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Server.Mappath方法攻取虚拟路径所对应的物理路径!");
Response.Write(Server.MapPath("/Response"));//Response.Write(Server.MapPath("/网站目录"));
}
使用Server对字符串编码和解码
protected void Button1_Click(object sender, EventArgs e)
{
string str = TextBox1.Text;
Label1.Text = Server.UrlEncode(str);//Server对字符串编码
}
protected void Button2_Click(object sender, EventArgs e)
{
string str = TextBox2.Text;
Label2.Text = Server.UrlDecode(str);//Server对字符串解码
}