//
用于保存文件的流
System.IO.FileStream stream = null ;
// 用于保存写入队对象
System.IO.TextWriter writer = null ;
string queryString = "" ;
System.Uri uri = new Uri( @" http://localhost:1138/Base64/imagehadlling/GridView_DropDownList.aspx " );
string targetFilePath = Server.MapPath( "" );
try
... {
//创建Http请求
HttpRequest request = new HttpRequest(uri.AbsolutePath, uri.AbsoluteUri, queryString);
//创建保存的文件流
stream = new System.IO.FileStream(@"F:defaut.html", System.IO.FileMode.Create);
//创建文件写入对象
writer = new System.IO.StreamWriter(stream, System.Text.UTF8Encoding.UTF8);
//创建Http反馈
HttpResponse Response = new HttpResponse(writer);
//创建Http上下文
HttpContext context = new HttpContext(request, Response);
//添加Session
context.Items.Add("AspSession", HttpContext.Current.Session);
//创建页面分析器
System.Web.IHttpHandler handler = System.Web.UI.PageParser.GetCompiledPageInstance(uri.AbsolutePath,
HttpContext.Current.Server.MapPath(uri.AbsolutePath), context);
//执行请求
handler.ProcessRequest(context);
//写入信息
writer.Flush();
//关闭
writer.Close();
}
catch (System.Exception ex)
... {
Label1.Text = ex.Message;
}
}
System.IO.FileStream stream = null ;
// 用于保存写入队对象
System.IO.TextWriter writer = null ;
string queryString = "" ;
System.Uri uri = new Uri( @" http://localhost:1138/Base64/imagehadlling/GridView_DropDownList.aspx " );
string targetFilePath = Server.MapPath( "" );
try
... {
//创建Http请求
HttpRequest request = new HttpRequest(uri.AbsolutePath, uri.AbsoluteUri, queryString);
//创建保存的文件流
stream = new System.IO.FileStream(@"F:defaut.html", System.IO.FileMode.Create);
//创建文件写入对象
writer = new System.IO.StreamWriter(stream, System.Text.UTF8Encoding.UTF8);
//创建Http反馈
HttpResponse Response = new HttpResponse(writer);
//创建Http上下文
HttpContext context = new HttpContext(request, Response);
//添加Session
context.Items.Add("AspSession", HttpContext.Current.Session);
//创建页面分析器
System.Web.IHttpHandler handler = System.Web.UI.PageParser.GetCompiledPageInstance(uri.AbsolutePath,
HttpContext.Current.Server.MapPath(uri.AbsolutePath), context);
//执行请求
handler.ProcessRequest(context);
//写入信息
writer.Flush();
//关闭
writer.Close();
}
catch (System.Exception ex)
... {
Label1.Text = ex.Message;
}
}