CustomErrorsSection.DefaultRedirect 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置重定向的默认 URL。
public:
property System::String ^ DefaultRedirect { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("defaultRedirect")]
public string DefaultRedirect { get; set; }
[<System.Configuration.ConfigurationProperty("defaultRedirect")>]
member this.DefaultRedirect : string with get, set
Public Property DefaultRedirect As String
属性值
发生错误时应用程序重定向到的默认 URL。
- 属性
例外
属性 DefaultRedirect 为 null. 这是默认值。
示例
下面的代码示例演示如何使用该 DefaultRedirect 属性。
请参阅类主题中的 CustomErrorsSection 代码示例,了解如何获取该部分。
// Get the currentDefaultRedirect
string currentDefaultRedirect =
customErrorsSection.DefaultRedirect;
' Get the currentDefaultRedirect
Dim currentDefaultRedirect As String = _
customErrorsSection.DefaultRedirect
注解
DefaultRedirect如果未指定,则会改为显示标准错误。 指定要 DefaultRedirect 激活的通用错误页,以防不存在错误自定义页。
注释
URL 可能是绝对值或相对值。 相对 URL 相对于指定错误所在的网页的 Web.config 文件 DefaultRedirect。 从波形符(~)开始的相对 URL 相对于应用程序的根路径。