复制代码 代码如下:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/octet-stream";
HttpRequest req = context.Request;
string filename = req.Url.AbsolutePath;
string userid = string.Empty;
if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies["userid"] != null)
{
userid = HttpContext.Current.Request.Cookies["userid"].Value;
}
if (userid == "1")
{
string uuu = context.Server.MapPath(filename);
context.Response.TransmitFile(uuu);
}
else
{
string u2 = context.Server.MapPath("default.rar");
context.Response.WriteFile(u2);
}
}
新闻热点
疑难解答
图片精选