Request Object:
Request has five (5) Collections, one (1) Property, and one (1) Method. You'll use the Collections far more than the property or the method.
Request Collections:
Below is a table of the Request Collections and descriptions of how they are used.
Client security info for SSL encryption Cookies Request.Cookies("cookieName")
Holds cookie value stored on the client Form Request.Form("formName")
Holds value sent via HTML Form QueryString Request.QueryString("keyName")
Name/Value pair appended to the end of the URL ServerVariables Request.ServerVariables("variableName")
Hold values sent in the HTTP Headers
ClientCertificate:
Request.ClientCertificate is used with S.S.L. (Secure Sockets Layer). It is beyond the scope of this web site.
Cookies:
We will learn Request.Cookies and Response.Cookies together in Lesson 08. Please be patient.
Form:
Request.Form is probably the workhorse of the Request Collections. The first script is a repeat from Lesson 03.
<%@LANGUAGE="JavaScript"%> <% //No ASP Here, just a regular HTML Page %> <HTML> <STRONG>Type something into the text box and submit it.</STRONG> <FORM ACTION="script08a.asp" METHOD="Post"> <INPUT TYPE="Text" NAME="WebPageVariable"><BR> <STRONG>How Much Money do you make each month?</STRONG><BR> <SELECT NAME="monthlySalary"> <OPTION>Under $5,000,000</OPTION> <OPTION>Above $5,000,000</OPTION> <OPTION>Nobody's darn business.</OPTION> </SELECT><BR> <INPUT TYPE="Submit" VALUE="Submit"> </FORM> </HTML>
Click Here to run script08.asp in a new window. It posts information to script08a.asp which is found below. In turn, script08a.asp posts information to script08b.asp which is also found below.
<%@LANGUAGE="JavaScript"%> <% var WebPageVariable = new String( Request.Form("WebPageVariable") ) WebPageVariable = WebPageVariable.toUpperCase(); var monthlySalary = new String( Request.Form("monthlySalary") ) monthlySalary = monthlySalary.toLowerCase(); %> <HTML> The Web Page Variable you typed is: <%=WebPageVariable%> <BR> The monthly salary you listed is: <%=monthlySalary%> <BR> <FORM ACTION="script08b.asp" METHOD="Get"> <INPUT TYPE="hidden" VALUE="<%=monthlySalary%>" NAME="QueryVariable"> <STRONG>Click the button to see Query Strings</STRONG><BR> <INPUT TYPE="submit" VALUE="Submit"> </FORM> </HTML>
We'll be using Request.Form when we "Post" an HTML form to the server. Notice that the NAME attribute in the HTML form corresponds to the "name" in
QueryString:
We'll be using Request.QueryString when we use an HTML form to "Get" a page from the server. Request.QueryString() is very similar to Request.Form(). Take a look at script08b.asp which I printed below.
<%@LANGUAGE="JavaScript"%> <% var QueryVariable = new String( Request.QueryString("QueryVariable") ) %> <HTML> The QueryString Value is: <%=QueryVariable%> <BR> <% if (QueryVariable != "Lesson 08's new Query!") { QueryVariable="Lesson 08's new Query!" QueryVariable=escape(QueryVariable) %> <A HREF="script08b.asp?QueryVariable=<%=QueryVariable%>">Click Here</A> for the link to <I>script08b.asp?QueryVariable=<%=QueryVariable%></I> <% } //closing bracket for if statement. %> </HTML>
If you haven't already, Click Here to run script08.asp in a new window. Cycle through all the forms and links, and then come back.
You can use Request.QueryString in two different ways. You can either use an HTML form to "Get" a page from the server, which will generate a query string. Or you can manually build a query string and add it to the backside of a link. We'll dissect script08b.asp from top to bottom.
var QueryVariable = new String( Request.QueryString("QueryVariable") )
The line above in script08b.asp corresponds to the line below from script08a.asp
<INPUT TYPE="hidden" VALUE="<%=monthlySalary%>" NAME="QueryVariable">
The NAME="someName" in the HTML form becomes the
About half way into script08b.asp are the lines I reprinted below.
<% if (QueryVariable != "Lesson 08's new Query!") { QueryVariable="Lesson 08's new Query!" QueryVariable=escape(QueryVariable) %>
We've already converted Request.QueryString() into a JavaScript string at the top of the script. So, now we can do a string comparison.
If the QueryVariable hasn't already been set equal to "Lesson 08's new Query!" then we do that. Then we use the
In lesson 14 we'll see a better way to encode URL's. When we study the Server Object, we'll see Server.URLEncode(). But for now, just know that escape() works.
You can have more than one QueryString on each page. If you lose count of your QueryStrings, then you use
The Request Shortcut:
Request.Form() and Request.QueryString() share a shortcut.
ServerVariables:
Server Variables represent the HTTP Headers sent to the server by the client. I won't demonstrate them all, because there are too many.
<%@LANGUAGE="JavaScript"%> <HTML> <TABLE BORDER="1"> <TR><TD>ALL_RAW</TD> <TD><%=Request.ServerVariables("ALL_RAW")%></TD></TR> <TR><TD>REMOTE_ADDR</TD> <TD><%=Request.ServerVariables("REMOTE_ADDR")%></TD></TR> <TR><TD>HTTP_USER_AGENT</TD> <TD><%=Request.ServerVariables("HTTP_USER_AGENT")%></TD></TR> <TR><TD>URL</TD> <TD><%=Request.ServerVariables("URL")%></TD></TR> </TABLE> </HTML>
Click Here to run the script in a new window.
Demonstrated above are four (4) server variables. There are (give or take) about 50 server variables available. You can look up the full list of server variables for yourself on the internet.
Misc. Notes:
Request.BinaryRead() is the lone method and TotalBytes is the lone property.
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]