ASP.NET Web Pages - klasser
- Previous page WebPages Eksempel
- Next page WebPages Sikkerhed
StringExtensions-klassen - metoder
方法 | 描述 |
---|---|
As<TValue>(String) | Konverter strengen til en stærktypet værdi af specificeret datatypen. |
As<TValue>(String, TValue) | Konverter strengen til specificeret datatypen, og specificer standardværdien. |
AsBool(String) | Konverter strengen til Boolean-værdi (true/false). |
AsBool(String, Boolean) | Konverter strengen til Boolean-værdi (true/false), og specificer standardværdien. |
AsDateTime(String) | Konverter strengen til DateTime-værdi. |
AsDateTime(String, DateTime) | Konverter strengen til DateTime-værdi, og specificer standardværdien. |
AsDecimal(String) | Konverter strengen til Decimal-tal. |
AsDecimal(String, Decimal) | Konverter strengen til Decimal-tal, og specificer standardværdien. |
AsFloat(String) | Konverter strengen til et Single-tal. |
AsFloat(String, Single) | Konverter strengen til et Single-tal, og specificer standardværdien. |
AsInt(String) | Konverter strengen til et heltal. |
AsInt(String, Int32) | Konverter strengen til et heltal, og specificer standardværdien. |
Is<TValue> | Tjek om strengen kan konverteres til specificeret datatypen. |
IsBool | Tjek om strengen kan konverteres til Boolean (true/false)-typen. |
IsDateTime | Tjek om strengen kan konverteres til DateTime-typen. |
IsDecimal | Tjek om strengen kan konverteres til Decimal-typen. |
IsEmpty | 检查字符串值是否为 nullptr 或空。 |
IsFloat | 检查字符串是否可以转换为 Single 类型。 |
IsInt | 检查字符串是否可以转换为整数。 |
WebPageBase 类 - 属性
属性 | 描述 |
---|---|
Layout | 获取或设置布局页的路径。 |
Output | 获取页面当前的 TextWriter 对象。 |
OutputStack | 获取当前页上下文的 TextWriter 对象的堆栈。 |
Page | 对页面、布局页和分页之间共享的页数据提供类似属性的访问。 |
PageData | 对页面、布局页和分页之间共享的页数据提供类似数组的访问。 |
WebPageBase 类 - 方法
方法 | 描述 |
---|---|
ConfigurePage | 在派生类中重写时,将基于父网页的配置来配置当前网页。 |
CreateInstanceFromVirtualPath | 使用指定的虚拟路径创建 WebPageBase 类的新实例。 |
DefineSection | 由内容页调用以创建指定的内容部分。 |
GetOutputWriter | 返回用于呈现页面的文本编写器实例。 |
InitializePage | 初始化当前页。 |
IsSectionDefined | 返回一个值,该值指示是否在页中定义了指定部分。 |
PopContext | 从 OutputStack 实例顶部返回并移除上下文。 |
PushContext | 在 OutputStack 实例顶部插入指定的上下文。 |
RenderBody | 在布局页中,将呈现不在指定部分中的内容页部分。 |
RenderPage | 在其他页内呈现某一页的内容。 |
RenderSection | 在布局页中,将呈现指定部分的内容。 |
Write | 将指定的参数作为封装的 HTML 写入。 |
WriteLiteral | 无需先对指定的对象进行 HTML 编码,即可将其写入。 |
其他常用的方法和属性
属性 | 描述 |
---|---|
Request.Cookies[key] | 获取或设置 HTTP cookie 的值。 |
Request.Files[key] | 获取当前请求中上传的文件。 |
Request.Form[key] | 获取以 POST 方法发送的数据(以字符串形式)的表单。 |
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 in HTML. |
Server.MapPath(virtualPath) | Return the physical path of the server for the specified virtual path. |
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. |
- Previous page WebPages Eksempel
- Next page WebPages Sikkerhed