SPUtility.Redirect Method (String, SPRedirectFlags, HttpContext)

Handles the redirection of an HTTP request.

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 _
) As Boolean
'Usage
Dim url As String
Dim flags As SPRedirectFlags
Dim context As HttpContext
Dim returnValue As Boolean

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

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.

Return Value

Type: System.Boolean
This method returns true if the redirection was made; otherwise this method returns false.

Remarks

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