ASP.NET Web Pages - Class

StringExtensions class - Method

Methods Description
As<TValue>(String) Convert the string to a strongly typed value of the specified data type.
As<TValue>(String, TValue) Convert the string to the specified data type and specify a default value.
AsBool(String) Convert the string to a Boolean value (true/false).
AsBool(String, Boolean) Convert the string to a Boolean value (true/false) and specify a default value.
AsDateTime(String) Convert the string to a DateTime value.
AsDateTime(String, DateTime) Convert the string to a DateTime value and specify a default value.
AsDecimal(String) Convert the string to a Decimal number.
AsDecimal(String, Decimal) Convert the string to a Decimal number and specify a default value.
AsFloat(String) Convert the string to a Single number.
AsFloat(String, Single) Convert the string to a Single number and specify a default value.
AsInt(String) Convert the string to an integer.
AsInt(String, Int32) Convert the string to an integer and specify a default value.
Is<TValue> Check if the string can be converted to the specified data type.
IsBool Check if the string can be converted to Boolean (true/false) type.
IsDateTime Check if the string can be converted to DateTime type.
IsDecimal Check if the string can be converted to Decimal type.
IsEmpty Check if the string value is nullptr or empty.
IsFloat Check if the string can be converted to a Single type.
IsInt Check if the string can be converted to an integer.

WebPageBase Class - Properties

Properties Description
Layout Get or set the path of the layout page.
Output Get the current TextWriter object of the page.
OutputStack Get the stack of TextWriter objects of the current page context.
Page Provide property-like access to page data shared between pages, layout pages, and master pages.
PageData Provide array-like access to page data shared between pages, layout pages, and master pages.

WebPageBase Class - Methods

Methods Description
ConfigurePage When overridden in derived classes, the current page is configured based on the configuration of the parent web page.
CreateInstanceFromVirtualPath Create a new instance of the WebPageBase class using the specified virtual path.
DefineSection Called by the content page to create the specified content section.
GetOutputWriter Return the text writer instance used to render the page.
InitializePage Initialize the current page.
IsSectionDefined Return a value indicating whether the specified section is defined in the page.
PopContext Return and remove the context from the top of the OutputStack instance.
PushContext Insert the specified context at the top of the OutputStack instance.
RenderBody In the layout page, the content page section that is not in the specified section will be displayed.
RenderPage Render the content of one page within other pages.
RenderSection In the layout page, the content of the specified section will be displayed.
Write Write the specified parameters as encapsulated HTML.
WriteLiteral You can write the specified object without first encoding it in HTML.

Other commonly used methods and properties

Properties Description
Request.Cookies[key] Get or set the value of the HTTP cookie.
Request.Files[key] Get the file uploaded in the current request.
Request.Form[key] Retrieve the data sent in the form using the POST method (in string format).
Request.QueryString[key] Get the collection of HTTP query string variables.
Request.Unvalidated(key) Optionally disable request validation for form elements, query string values, and cookies.
Response.AddHeader() Add an HTTP header to the output stream.
Response.OutputCache() Configure the cache strategy of the HTTP response instance.
Response.Redirect(path) Redirect the client to a new URL.
Response.SetStatus(StatusCode) Set the HTTP status code of the HTTP response.
Response.WriteBinary() Write the byte sequence of binary content of the specified MIME type to the HTTP response output stream.
Response.WriteFile(file) Write the specified file directly to the HTTP response output stream.
@section(sectionName) Define the content part with the specified name.
Server.HtmlDecode(htmlText) Decode a string that has been HTML encoded.
Server.HtmlEncode(text) Encode a string as HTML.
Server.MapPath(virtualPath) Return the physical path of the specified virtual path on the server.
Server.UrlDecode(urlText) Convert a string that has already been encoded for URL transmission to a decoded string.
Server.UrlEncode(text) Encode a string to ensure reliable HTTP transmission from server to client through URLs.
Session[key] Get or set a value that will persist until the user closes the browser.
ToString() Display the string representation of the object's value.
UrlData[index] Get data related to the URL path.