一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - ASP教程 - javascript asp教程服務器對象

javascript asp教程服務器對象

2019-10-22 10:21asp技術網 ASP教程

javascript asp教程服務器對象

Overview:

The Server Object has seven (7) Methods, one (1) Property, zero (0) Events, and zero (0) Collections.

List of Methods:

 

Server Methods

CreateObject( )

Server.CreateObject("ADODB.Recordset")
Create an instance of an Object

Execute( )

Server.Execute("fileName.asp")
Executes an outside file (effect is similar to SSI)

GetLastError( )

Server.GetLastError()
Returns location and description of the last ASP error

HTMLEncode( )

Server.HTMLEncode("some String")
Encodes string to HTML characters

MapPath( )

Server.MapPath("\\virtualFolder")
Converts virtual path to physical path

Transfer( )

Server.Transfer("fileName.asp")
Transfers execution out of one page and into another

URLEncode( )

Server.URLEncode("some String")
Encodes string to URL standards

 

Below is the script for Lesson 14.

<%@LANGUAGE="JavaScript"%>
<HTML>
<BODY>
<%=Server.URLEncode("Hello, this string is URL Encoded!")%>
<BR><BR>
Now let's see a reprint of Script14a.asp.
I did not type it manually. Instead, I let
Server.CreateObject( ) do all the work.<BR>
<STRONG>
<%
Server.ScriptTimeout=10
var ASPScriptObject = Server.CreateObject("Scripting.FileSystemObject");
var myPath=Server.MapPath("\\") + "\\Section04\\script14a.asp"
var AspScript = ASPScriptObject.OpenTextFile(myPath);
var outputScript="";

while(!AspScript.AtEndOfStream)
	{
	outputScript += AspScript.ReadLine() + "\r";
	}

outputScript = new String(outputScript);
outputScript=Server.HTMLEncode(outputScript)
AspScript.Close();
outputScript = "<PRE>" + outputScript + "</PRE>";
Response.Write(outputScript)
%>
</STRONG>
</BODY>
</HTML>

Click Here to run the script in a new window.

I demonstrated four methods in the script14.asp. We'll take them from top to bottom.

Explaining the Script:

Server.URLEncode() does exactly what you think it does. It takes a string and encodes it to RFC 1738 standards. That's more than you ever wanted to know about Server.URLEncode(), isn't it?

Next we have Server.CreateObject(). In this case I created an instance of the FileSystem Object. The most common objects that you will instanciate are ADODB.Recordset, Scripting.FileSystemObject, Scripting.Dictionary, MSWC.AdRotator, MSWC.BrowserType, MSWC.NextLink, and MSWC.ContentRotator. There are many good resources on all of these created Objects. Most of them are beyond the scope of this web site.

Next on the list is Server.MapPath(). Looking back at script14.asp, do you see the double slashes (\\) in the MapPath argument? That's not an accident. We have to use escape characters in JavaScript.

The last Method I demonstrate is Server.HTMLEncode(). It converts HTML flags into non-HTML equivalents.

The Lone Property:

Server has one property: ScriptTimeout. It sets the maximum number of seconds allowable for script execution. If the script execution exceeds that time, then it times out. The user gets an ugly message but at least the Web Server can quit executing your darned greedy script and go about other business.

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 花唇肿胀无法合拢双性 | 蜜月aⅴ免费一区二区三区 蜜桃影像传媒推广 | 日本免费全黄一级裸片视频 | h版在线观看 | 欧美三级做爰全过程 | 国产农村一级特黄α真人毛片 | 亚州精品视频 | 欧美精品色精品一区二区三区 | yy6080欧美三级理论 | 国产精品边做边接电话在线观看 | 亚洲日本中文字幕天堂网 | 四虎成人影院 | 亚洲小视频在线 | 美女班主任让我爽了一夜视频 | 99久久一区二区精品 | 欧美三级免费观看 | 视频一区二区三区在线 | 亚洲男人天堂网址 | 青青草国产精品久久久久 | 奇米影视7777| 99热最新在线观看 | 欧美在线一级视频 | 久草青青在线 | 日韩国产欧美精品综合二区 | 国产网站免费观看 | 天天做日日做天天添天天欢公交车 | 午夜福利理论片在线播放 | 成人影院在线观看 | 精品国产自在现线拍国语 | 天堂在线观看中文字幕 | 福利片免费一区二区三区 | 日韩成人在线视频 | 成年人在线视频观看 | av毛片在线看 | xxx黑人又大粗又长 xxxx性欧美极品另类 | 调教肉文| 日韩欧美一区二区不卡 | 亚洲色图二区 | 男女肉文高h | 波多野结衣亚洲一区 | 欧美日韩一区二区综合在线视频 |