ASP.NET操作Cookie
//创建
HttpCookie cookie = new HttpCookie("user","111");//创建Cookie
cookie Expires = DateTime.Now.Add(15);//设置过期时间
Response.Cookies.Add(cookie);//存入客户端
我们取出Cookie值也很简单
string value = Request.Cookies["user"].value;
有时候我们想在一个Cookie中储存多个信息,那也没有问题。比如我们在名为user的cookie下加多个信息
HttpCookie cookie = new HttpCookie("user");
cookie.Values.Add("name","222");
cookie.Values.Add("pwd","333");
cookie.Values.Add("member","admin");
Response.Cookies.Add(cookie);
从客户端获取取信息也一样简单
HttpCookie cookie = Request.Cookies["user"];
value1 = cookies.Values["name"];
value2 = cookies.Values["pwd"];
相关文档:
常用函数系列:
public static string Get_ClientIP() 得到客户端IP
public static string Get_CMac(string IP) 得到客户端 CMac 地址
public static string RequestF(string xPName,string xPType,int xLenDef) 安全接收数据系列
public static string Show_Cont(string xStr) 过滤显示字串
public static str ......
做网站与搞安全一般都离不开权限分配,网站权限一般都直接设置站点所在的虚拟目录的,也就是在虚拟目录的安全里添加internet来宾账户,并分配除完全控制外的所有权限;如果是.NET,还必须给ASP.NET用户配置除完全控制以外的权限!
一般情况下,这样就OK了,服务器上的一般网站都可以正常运行了!但现在我发现:C\WINDOWS ......
ASP.NET文件下载函数使用是什么情况呢?在你的Page_Load中添加这样的代码:
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, "目的文件名称", @"源文件路径", 1024000);
if (!success) Response.Write("下载文件出错!"); Page.Response.End();
ASP.NET文件下载函数代码为:
......
1.获取Return返回值
程序代码//存储过程
//Create PROCEDURE MYSQL
// @a int,
// @b int
//AS
// return @a + @b
//GO
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ToStri ......