SPUtility.Redirect method (String, SPRedirectFlags, HttpContext)

Handles the redirection of an HTTP request.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)


Public Shared Function Redirect ( _
    url As String, _
    flags As SPRedirectFlags, _
    context As HttpContext _
) As Boolean
Dim url As String
Dim flags As SPRedirectFlags
Dim context As HttpContext
Dim returnValue As Boolean

returnValue = SPUtility.Redirect(url, _
    flags, context)
public static bool Redirect(
    string url,
    SPRedirectFlags flags,
    HttpContext context


  • 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.


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


SPUtility class

SPUtility members

Redirect overload

Microsoft.SharePoint.Utilities namespace