ASP.NET知识点

1、在页面中输出数据(后台代码弹出提示框)

       (1)、Response.Write("<script>alert('上传成功!');</script>");  或者  Response.Write("<script>alert('"+str_message+"');</script>"); 

       (2)、RegisterStartupScript("true","<script>alert('上传成功!')</script>");

 2、页面跳转并传递参数  (在页面重定向URL时传递参数,使用”?“分隔页面的链接地址和参数,多个参数时,参数与参数间用”&“分隔)

         (1)Response.Redirect("~/welcome.aspx“);

         (2)Response.Redirect("~/welcome.aspx?parameter=one“);

         (3)Response.Redirect("~/welcome.aspx?Name="+name+"&Sex="+sex);

                在welcome.aspx页面的后台代码中获取参数 ,三种方法:

                   string name=Request["Name"];

                   string name = Request.Params["Name"];

                   string name = Request.QueryString["Name"];

3、Response.Write("<hr>"); 横线      Response.Write("<br>");换行

4、Application对象

5、使用Session 对象存储和读取数据

         Session["UserName"] = txtUserName.Text;//使用Session变量记录用户名   (页面1中)

          Response.Write("欢迎用户"+Session["UserName"].ToString ()+"登录本系统!<br>");   (页面2中)

6、Cookie 对象  

            (1)读取客户端IP

             string UserIP = Request.UserHostAddress.ToString();
             Response.Cookies["IP"].Value = UserIP;

            (2)写入标签  this.Label1.Text = Request.Cookies["IP"].Value;      

 7、Server对象   

                属性:MachineName  (获取服务器的计算机名称)   ;  ScriptTimeout   (获取和设置请求超时值)

     8、  

IndexOf、LastIndexOf、Substring的用法

posted on 2014-05-10 17:09  AllEn—Carina  阅读(275)  评论(0编辑  收藏  举报