zoukankan      html  css  js  c++  java
  • ASP.NET六大巨头——内置对象(1)

        ASP.NET提供了六个内置对象:Request、Response、Application、Session、Server和Cookie。这些对象收集当前应用程序请求、用户信息、响应浏览器信息,来完毕页面的管理和信息传递。

       Request对象

    用于检索从浏览器向server所发送的请求中的信息。Request对象读取client在Web页面请求时发送的值。

    使用:

     1)当method="post"

         string userName = Request["txtUserName"].ToString();
                 string userPwd = Request["txtUserPwd"].ToString();

        string userName = Request.Form.Get("txtUserName");
                 string userPwd = Request.Form.Get("txtUsrPwd");

     2)当method="get"

         string userName=Request.QueryString["txtUserName"].ToString();

         string userPwd=Request.QueryString["txtUserPwd"].ToString();

       Response对象

    用于将数据从server发送回浏览器。

    使用:

        属性和方法:

    write()直接向client发送字符串信息

    redirect()直接向某个网页跳转

    Response.Write("username不对!");

    Response.Redirect("WebForm2.aspx");

    Application对象

          用于共享应用程序级信息,维护整个应用程序的一组变量。这些变量能够由全部訪问该应用程序的用户

             共享。

     使用:

    1)保存信息:Application("")=值;

    2)添加键:application.add("键名",值);

    3)删除键:application.remove("键名",值);

    这些仅仅是对这三个对象的初步了解,当然还须要再后面对这些对象多多使用,使用过程中才干对这些内容有一个更深的理解,仅仅有对这些知识进行研究之后才可以更好的使用。

  • 相关阅读:
    User类 新增共有属性Current ID
    关于multi-label classification中评价指标的一些理解
    Improved Few-Shot Visual Classification草草阅读
    文献阅读:A New Meta-Baseline for Few-Shot Learning
    Windows 10系统在Anaconda下安装GPU版Pytorch
    第九章实验
    实验 5 编写、调试具有多个段的
    实验 4 [bx]和loop的使用
    实验三
    实验 2 用机器指令和汇编指令编程
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6907557.html
Copyright © 2011-2022 走看看