| Response.AppendHeader 使用 | |
| 大狗熊 | 文件下载,指定默认名srxljl 页面转向srxljl 强制浏览器显示一个用户名/口令对话框srxljl |
| 楼主 创建:08-08-28 16:05:37 更新:08-08-28 16:05:37 | |
| 发表回复 | |
| 1/1(共1页) | |
| 大狗熊 | using System; using System.IO; using System.Web.UI; using System.Web.Security; using Dang.Util; namespace Dang.Home.Web { public class snap_shot : Page { protected void Page_Load(object sender, EventArgs e) { string auth = null; string[] up = null; if ( (auth = Request.Headers["Authorization"]) != null && auth.Length > 6 && (up = EConvert.FromBase64(auth.Substring(6)).Split(':')).Length > 1 && FormsAuthentication.Authenticate(up[0], up[1]) ) return; Response.AppendHeader("WWW-Authenticate", "Basic realm=enter your username and password"); Response.StatusCode = 401; Response.Write("Access Dined"); Response.End(); } protected void btnOK_Click(object sender, EventArgs e) { StringWriter writer = new StringWriter(); Server.Execute("default.aspx", writer); string html = writer.ToString(); writer.Close(); Response.Write(WebHelper.Write("index.html", html) ? "写入成功" : "写入失败"); } } } |
| 1楼 创建:08-09-23 19:54:29 更新:08-09-23 19:54:29 | |
| 发表回复 | |