asp.net 程序自动提交登陆表单并保持Session及Cookie
1、通过附加一个cookiecontainer到httprequest对象中,可以得到登录后返回的代表SESSION ID的COOKIE。
2、将此COOKIE包含在一个cookiecontainer中并附加到另一个HTTPREQUEST请求中,则可以实现SESSION的还原。
部分主要代码:
CookieContainer cookieContainer = new CookieContainer();
///////////////////////////////////////////////////
//
1. 打开 Login.aspx 页面,获得 VeiwState & EventValidation。
//
如果是登陆页为asp.net页面,需要获取VeiwState及EventValidation
///////////////////////////////////////////////////
//
设置打开页面的参数
string
URI
=
http://localhost/Test/Login.aspx
;
HttpWebRequest request
=
WebRequest.Create(URI)
as
HttpWebRequest;
request.Method
=
"
GET
"
;
request.KeepAlive
=
false
;
//
接收返回的页面
HttpWebResponse response
=
request.GetResponse()
as
HttpWebResponse;
System.IO.Stream responseStream
=
response.GetResponseStream();
System.IO.StreamReader reader
=
new
System.IO.StreamReader(responseStream,Encoding.UTF8);
&nb
相关文档:
一、性能参数:
1、 吞吐量
2、 响应时间
3、 执行时间
4、 可伸缩性
二、性能因素:
1、ASPX执行环境
2、编写代码逻辑
三、提高性能的方法:
1、 避免不必要的操作.例如:在Page_Load中使用IsPostBack;
2、 尽量减少使用服务器端控件
3、 关闭不必要 ......
ASP.NET软件工程师面试题
一、选择题
1. int[][] myArray3=new int[3][]{new int[3]{5,6,2},new int[5]{6,9,7,8,3},new int[2]{3,2}}; myArray3[2][2]的值是()。
A. 9
B. 2
C. &n ......
asp.net中常用的26个优化性能的方法
1. 数据库访问性能优化
数据库的连接和关闭
访问数据库资源需要创建连接、打开连接和关闭连接几个操作。这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源。ASP.NET中提供了连接池(Connection Pool)改善打开和关闭数据库对性能的影响。系统将用户的 ......