转:ASP.NET页面传值的几种方式
一. 使用QueryString变量
QueryString是一种非常简单也是使用比较多的一种传值方式,但是它将传递的值显示在浏览器的地址栏中,如果是传递一个或多个安全性要求不高或是结构简单的数值时,可以使用这个方法。
Response.Redirect( "target.aspx?param1=hello¶m2=hi ")
接收页面: string str = Request.QueryString["param1"];
string str1 = Request.QueryString["param2];
二.使用Cookie对象变量(Cookie是存放在客户端的)
设置Cookie: HttpCookie cookie_name = new HttpCookie("name");
cookie_name.Value = Label1.Text;
Reponse.AppendCookie(cookie_name);
获取Cookie:
string name= Request.Cookie["name"].Value.ToString();
三. 使用Session变量(session是存放在服务器端的)
设置Session: Session["name"] ="hello";
获取Session: string name = Session["name"].ToString();
四.使用Application 对象变量
Application对象的作用范围是整个全局,也就是说对所有用户都有效。此种方法不常使用,因为Application在一个应用程序域范围共享,所有用户可以改变及设置其值,故只应用计数器等需要全局变量的地方。
&n
相关文档:
2010-01-25 14:24
40条ASP.NET开发Tip
作者:麒麟 来源:博客园 发布时间:2010-01-21 13:16 阅读:287 次 原文链接 [收藏]
1、在compilation 下,请设置debug=false ,如下:
default Language="c#" debug="false">
2、请使用Server.Tran ......
FCKeditor相关资料简介:
官方网站http://www.fckeditor.net/
官方文档http://wiki.fckeditor.net/
下载地址http://www.fckeditor.net/download/default.html
官方演示http://www.fckeditor.net/demo/default.html
FCKEditor asp.net设置
下载:http://www.fckeditor.net
(要下载FCKeditor2.4.2.zip和FCKeditor.NET ......
1.//弹出对话框.点击转向指定页面
Response.Write(" <script>window.alert('该会员没有提交申请,请重新提交!')
</script>");
Response.Write(" <script>window.location
='http://www.51aspx.com/bizpulic/upmeb.aspx' </script>");
2.//弹出对话框
Response.Write(" <script lang ......
1. 数据库访问性能优化
数据库的连接和关闭
访问数据库资源需要创建连接、打开连接和关闭连接几个操作。这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源。 ASP.NET中提供了连接池(Connection Pool)改善打开和关闭数据库对性能的影响。系统将用户的数据库连接放在连接池中,需要时取出,关闭时 ......
WCF的架构:using System.ServiceModel;
契约:Contract
[ServiceContract]
public partial interface IContract
{
[OperationContract]
string DocumentWebHostUrl();
}
服务:Service
[ServiceBehavior(IncludeException ......