Monday, June 28, 2021

Server Object (IIS)

"Server" Object (IIS)

You can use the Server object to access methods and properties on the server. Most of these methods and properties serve as utility functions.

Server object methods

  1. CreateObject
  2. Execute 
  3. GetLastError 
  4. HTMLEncode 
  5. MapPath 
  6. Transfer 
  7. URLEncode 
Server.CreateObject creates an instance of a server component.
The CreateObject method creates an instance of a server component. If the component has implemented the OnStartPage and OnEndPage methods, the OnStartPage method is called at this time.

<% Set MyAd = Server.CreateObject("MSWC.AdRotator") %>

Server.Execute executes an .asp file.

Server.GetLastError returns an ASPError object that describes the error condition.

Server.HTMLEncode applies HTML encoding to the specified string.
The HTMLEncode method applies HTML encoding to a specified string. This is useful as a quick method of encoding form data and other client request data before using it in your Web application. Encoding data converts potentially unsafe characters to their HTML-encoded equivalent. If the string to be encoded is not DBCS, HTMLEncode converts characters as follows:
  • The less-than character (<) is converted to &lt;.
  • The greater-than character (>) is converted to &gt;.
  • The ampersand character (&) is converted to &amp;.
  • The double-quote character (") is converted to &quot;.
  • Any ASCII code character whose code is greater-than or equal to 0x80 is converted to &#<number>, where <number> is the ASCII character value.
If the string to be encoded is DBCS, HTMLEncode converts characters as follows:
All extended characters are converted.
Any ASCII code character whose code is greater-than or equal to 0x80 is converted to &#<number>, where <number> is the ASCII character value.
Half-width Katakana characters in the Japanese code page are not converted.

Server.MapPath maps the specified virtual path, either the absolute path on the current server or the path relative to the current page, into a physical path. https://docs.microsoft.com/en-us/dotnet/api/system.web.httpserverutility.mappath?view=netframework-4.

Server.Transfer sends all of the current state information to another .asp file for processing

Server.URLEncode applies URL encoding rules, including escape characters, to the string.



No comments:

Post a Comment

Hot Topics