TeamMentor.CoreLib.IREST_ExtensionMethods.redirect_To_Page C# (CSharp) Method

redirect_To_Page() public static method

public static redirect_To_Page ( this iRestAdmin, string redirectTarget ) : ITM_REST
iRestAdmin this
redirectTarget string
return ITM_REST
        public static ITM_REST redirect_To_Page(this ITM_REST iRestAdmin, string redirectTarget)
        {
            var webOperationContext = WebOperationContext.Current;
            if (webOperationContext.notNull())
            {
                redirectTarget = redirectTarget.replace("//","/");            // in case they made it this far, prevent urls that have //
                iRestAdmin.response_ContentType_Html();
                webOperationContext.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Redirect;
                webOperationContext.OutgoingResponse.Headers.Add("Location", redirectTarget);
            }
            return iRestAdmin;
        }