Codecore Logo
Quick Search
»
Advanced Search »

Server Object

RSS
Enables sharing of global information across multiple sessions and requests within an web application.


Instance Properties

MachineName

Gets the server's computer name.

Accessibility : Read Only

Type: String

ScriptTimeout

Gets and sets the request time-out value in seconds.

Accessibility : Read Only

Type: Number

Instance Methods

HtmlDecode

Decodes an HTML-encoded string and returns the decoded string.

Syntax:

String HtmlDecode( String s )

Parameters:

s: The HTML string to decode.

Return Value:

The HTML-decoded text.

Example:


decodedString = Server.HtmlDecode( encodedString );

HtmlEncode

HTML-encodes a string and returns the encoded string.

Syntax:

String HtmlEncode( String s )

Parameters:

s: The HTML encoded string.

Return Value:

The HTML-encoded text.

Example:


encodedString = Server.HtmlEncode( s );

MapPath

Returns the physical file path that corresponds to the specified virtual path on the Web server.

The MapPath method potentially contains sensitive information about the hosting environment. The return value should not be displayed to users.

Syntax:

String MapPath( String path )

Parameters:

path: The virtual path of the Web server.

Return Value:

The physical file path that corresponds to path.

Example:


filePath = Server.MapPath("/MyWebSite");

Transfer ( String )

For the current request, terminates execution of the current page and starts execution of a new page by using the specified URL path of the page.

Syntax:

void Transfer( String path )

Parameters:

path: The URL path of the new page on the server to execute.

Example:


Server.Transfer("mypage.j9sp");

Transfer ( String, Boolean )

Terminates execution of the current page and starts execution of a new page by using the specified URL path of the page. Specifies whether to clear the QueryString and Form collections.

Syntax:

void Transfer( String path, Boolean preserveForm )

Parameters:

path: The URL path of the new page on the server to execute.

preserveForm: true to preserve the QueryString and Form collections; false to clear the QueryString and Form collections.

Example:


Server.Transfer("mypage.j9sp", true);

UrlDecode

Decodes a string that was encoded for HTTP transmission and then sent to the server in a URL.

URL encoding ensures that all browsers will correctly transmit text in URL strings. Characters such as a question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers. As a result, these characters must be encoded in <a> tags or in query strings where the strings can be re-sent by a browser in a request string.

Syntax:

String UrlDecode( String s )

Parameters:

s: The HTML string to decode.

Return Value:

The Url-decoded text.

Example:


decodedString = Server.UrlDecode( encodedString );

UrlEncode

Encodes a string for reliable HTTP transmission from the Web server to a client through the URL.

URL encoding ensures that all browsers will correctly transmit text in URL strings. Characters such as a question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers. As a result, these characters must be encoded in <a> tags or in query strings where the strings can be re-sent by a browser in a request string.

Syntax:

String UrlEncode( String s )

Parameters:

s: The Url encoded string.

Return Value:

The Url-encoded text.

Example:


encodedString = Server.UrlEncode( s );

UrlPathEncode

URL-encodes the path section of a URL string and returns the encoded string.

URL encoding ensures that all browsers will correctly transmit text in URL strings. Characters such as a question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers. As a result, these characters must be encoded in <a> tags or in query strings where the strings can be re-sent by a browser in a request string.

Syntax:

String UrlPathEncode( String s )

Parameters:

s: The text to URL-encode.

Return Value:

The Url-encoded text.

Example:


Response.Write( "<A HREF = " + Server.UrlPathEncode(MyURL) +  "> ASP.NET Examples <br>" );

See Also

Application Object
Request Object
Response Object
Session Object
Privacy Policy | Conditions Of Use

Copyright ©2014 Codecore Technologies, All rights reserved.