다음을 통해 공유


SPUtility.Redirect Method (String, SPRedirectFlags, HttpContext, String)

Handles the redirection of an HTTP request. This method allows for the optional specification of an encoded query string to be added to the URL.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedExternalType)> _
Public Shared Function Redirect ( _
    url As String, _
    flags As SPRedirectFlags, _
    context As HttpContext, _
    queryString As String _
) As Boolean
'Usage
Dim url As String
Dim flags As SPRedirectFlags
Dim context As HttpContext
Dim queryString As String
Dim returnValue As Boolean

returnValue = SPUtility.Redirect(url, _
    flags, context, queryString)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedExternalType)]
public static bool Redirect(
    string url,
    SPRedirectFlags flags,
    HttpContext context,
    string queryString
)

Parameters

  • url
    Type: System.String

    The destination URL to be used in the redirection.

  • context
    Type: System.Web.HttpContext

    The HTTPContext object that provides HTTP information about the current HTTP request.

  • queryString
    Type: System.String

    An encoded query string to be appended to the selected URL. This parameter is optional.

Return Value

Type: System.Boolean
true if the redirection was made; otherwise, false.

Remarks

If the SPRedirectFlags.UseSource flag is set, this method redirects to the source query string, if it is available. If this flag is not set or if the source query string is not available, this method redirects to the URL specified in the url parameter.

This method performs validation of the URL depending on the flags set in the SPRedirectFlags enumeration. Set the SPRedirectFlags.Trusted flag to ensure that the URL is valid without checking whether the URL destination is located on a local server. To perform the redirection without validation, set the SPRedirectFlags.Static flag.

See Also

Reference

SPUtility Class

SPUtility Members

Redirect Overload

Microsoft.SharePoint.Utilities Namespace