ASP.NET Web Pages - Class


ASP.NET Class Reference

Methods Description
AsBool(), AsBool(true|false) Converts a string value to a Boolean value (true/false). If the string cannot be converted to true/false, returns false or another specified value.
AsDateTime(), AsDateTime(value) Converts a string value to date/time. Returns DateTime. If the string cannot be converted to a date/time, returns MinValue or another specified value.
AsDecimal(), AsDecimal(value) Converts a string value to a decimal value. If the string cannot be converted to a decimal value, returns 0.0 or another specified value.
AsFloat(), AsFloat(value) Converts a string value to a floating-point number. If the string cannot be converted to a floating-point number, returns 0.0 or another specified value.
AsInt(), AsInt(value) Converts a string value to an integer. If the string cannot be converted to an integer, returns 0 or another specified value.
Href(path [, param1 [, param2]]) Creates a browser-compatible URL from a local file path with an optional additional path part.
Html.Raw(value) Renders valueRenders as HTML markup instead of rendering as HTML-encoded output.
IsBool(), IsDateTime(), IsDecimal(), IsFloat(), IsInt() Returns true if the value can be converted from a string to the specified type.
IsEmpty() Returns true if the object or variable has no value.
IsPost Returns true if the request is POST. (The initial request is usually GET.)
Layout Specifies the path of the layout page to apply to this page.
PageData[key], PageData[index], Page Contains shared data between the current request's pages, layout pages, and partial pages. You can use a dynamic page object to access the same data by property.
RenderBody() (Layout pages) Renders the content of a content page that is not in any named sections.
RenderPage(path, values)
RenderPage(path[, param1 [, param2]])
Renders a content page using the specified path and optional extra data. You can get the value of extra parameters from PageData by position (Example 1) or by key (Example 2).
RenderSection(sectionName [, required = true|false]) (Layout pages) Renders a named content section. SetsrequiredMakes a section required, not optional.
Request.Cookies[key] Gets or sets the value of an HTTP cookie.
Request.Files[key] Gets the files uploaded in the current request.
Request.Form[key] Gets data posted in a form (as a string). Both Request.Form and Request.QueryString require [key] checking.
Request.QueryString[key] Gets data specified in the URL query string. Both Request.Form and Request.QueryString require [key] checking.
Request.Unvalidated(key)
Request.Unvalidated().QueryString|Form|Cookies|Headers[key]
Optionally disables request validation (form elements, query string values, cookies, header values). Request validation is enabled by default to prevent users from submitting markup or other potentially dangerous content.
Response.AddHeader(name, value) Adds an HTTP server response header to the response.
Response.OutputCache(seconds [, sliding] [, varyByParams]) Caches the page output cache for the specified time. Setsslidingto reset the timeout for each page visit, and setsvaryByParamsto cache a different version of the page for each different query string of the requested page.
Response.Redirect(path) Redirects the browser request to a new location.
Response.SetStatus(httpStatusCode) Sets the HTTP status code to send to the browser.
Response.WriteBinary(data [, mimetype]) Writesdatacontent to the response with an optional MIME type.
Response.WriteFile(file) Writes file content to the response.
@section(sectionName) { content } (Layout pages) Defines a named content section.
Server.HtmlDecode(htmlText) Decodes an HTML-encoded string.
Server.HtmlEncode(text) Encodes a string for rendering in HTML markup.
Server.MapPath(virtualPath) Returns the server's physical path for the specified virtual path.
Server.UrlDecode(urlText) Decodes URL text.
Server.UrlEncode(text) Encodes URL text.
Session[key] Gets or sets a value that persists until the user closes the browser.
ToString() Displays the value of an object as a string.
UrlData[index] Gets extra data from the URL (for example,/MyPage/ExtraData)。


Other extensions