當前位置: 首頁>>代碼示例>>C#>>正文


C# HttpResponseBase.Redirect方法代碼示例

本文整理匯總了C#中System.Web.HttpResponseBase.Redirect方法的典型用法代碼示例。如果您正苦於以下問題:C# HttpResponseBase.Redirect方法的具體用法?C# HttpResponseBase.Redirect怎麽用?C# HttpResponseBase.Redirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Web.HttpResponseBase的用法示例。


在下文中一共展示了HttpResponseBase.Redirect方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Apply

        public void Apply(HttpResponseBase response)
        {
            if(response == null)
            {
                throw new ArgumentNullException("response");
            }

            response.Cache.SetCacheability(Cacheability);

            if (HttpStatusCode == HttpStatusCode.SeeOther || Location != null)
            {
                if (Location == null)
                {
                    throw new InvalidOperationException("Missing Location on redirect.");
                }
                if (HttpStatusCode != HttpStatusCode.SeeOther)
                {
                    throw new InvalidOperationException("Invalid HttpStatusCode for redirect, but Location is specified");
                }

                response.Redirect(Location.ToString());
            }
            else
            {
                response.StatusCode = (int)HttpStatusCode;
                response.ContentType = ContentType;
                response.Write(Content);

                response.End();
            }
        }
開發者ID:dmarlow,項目名稱:authservices,代碼行數:31,代碼來源:CommandResult.cs

示例2: FillResponse

 public void FillResponse(HttpResponseBase response, HttpContextBase context)
 {
     var trigger = context.Request.Params["trigger"];
     var jobGroup = context.Request.Params["group"];
     _schedulerProvider.Scheduler.PauseTrigger(trigger, jobGroup);
     response.Redirect(context.Request.UrlReferrer.OriginalString);
 }
開發者ID:JustAGhosT,項目名稱:CrystalQuartz,代碼行數:7,代碼來源:PauseTriggerFiller.cs

示例3: EvaluateResponse

 private static void EvaluateResponse(Response response, HttpResponseBase httpResponse)
 {
     response.MatchAction(
         content: x => httpResponse.Raw(x.Content, x.ContentType),
         xdoc: x => httpResponse.XDocument(x.Content, x.ContentType),
         redirect: x => httpResponse.Redirect(x.Location));
 }
開發者ID:modulexcite,項目名稱:QuartzNetWebConsole,代碼行數:7,代碼來源:ControllerFactory.cs

示例4: FillResponse

 public void FillResponse(HttpResponseBase response, HttpContextBase context)
 {
     var jobName = context.Request.Params["job"];
     var jobGroup = context.Request.Params["group"];
     _schedulerProvider.Scheduler.ResumeJob(jobName, jobGroup);
     response.Redirect(context.Request.UrlReferrer.OriginalString);
 }
開發者ID:JustAGhosT,項目名稱:CrystalQuartz,代碼行數:7,代碼來源:ResumeJobFiller.cs

示例5: Apply

        public static void Apply(this CommandResult commandResult, HttpResponseBase response)
        {
            if (commandResult == null)
            {
                throw new ArgumentNullException(nameof(commandResult));
            }

            if (response == null)
            {
                throw new ArgumentNullException(nameof(response));
            }

            if (commandResult.HttpStatusCode == HttpStatusCode.SeeOther || commandResult.Location != null)
            {
                if (commandResult.Location == null)
                {
                    throw new InvalidOperationException("Missing Location on redirect.");
                }
                if (commandResult.HttpStatusCode != HttpStatusCode.SeeOther)
                {
                    throw new InvalidOperationException("Invalid HttpStatusCode for redirect, but Location is specified");
                }

                response.Redirect(commandResult.Location.OriginalString);
            }
            else
            {
                response.StatusCode = (int)commandResult.HttpStatusCode;
                response.ContentType = commandResult.ContentType;
                response.Write(commandResult.Content);

                response.End();
            }
        }
開發者ID:biancini,項目名稱:OpenIDConnect-Csharp-Client,代碼行數:34,代碼來源:CommandResultHttpExtension.cs

示例6: Apply

        public void Apply(HttpResponseBase response)
        {
            response.Cache.SetCacheability(Cacheability);

            if (HttpStatusCode == HttpStatusCode.SeeOther || Location != null)
            {
                if (Location == null)
                {
                    throw new InvalidOperationException("Missing Location on redirect.");
                }
                if (HttpStatusCode != HttpStatusCode.SeeOther)
                {
                    throw new InvalidOperationException("Invalid HttpStatusCode for redirect, but Location is specified");
                }

                response.Redirect(Location.ToString());
            }

            response.StatusCode = (int)HttpStatusCode;
        }
開發者ID:halad,項目名稱:authservices,代碼行數:20,代碼來源:CommandResult.cs

示例7: Login

        private void Login(ref HttpResponseBase response)
        {
            iisTraceListener.WriteLine("Login");
            iisTraceListener.WriteLine(ConfigurationManager.AppSettings["RemoteLoginUrl"]);
            iisTraceListener.Flush();

            response.Redirect((ConfigurationManager.AppSettings["RemoteLoginUrl"] as string), true);
        }
開發者ID:timothyallyndrake,項目名稱:portfolio,代碼行數:8,代碼來源:BaseReportController.cs

示例8: FillResponse

 public void FillResponse(HttpResponseBase response, HttpContextBase context)
 {
     _schedulerProvider.Scheduler.Start();
     response.Redirect(context.Request.UrlReferrer.OriginalString);
 }
開發者ID:JustAGhosT,項目名稱:CrystalQuartz,代碼行數:5,代碼來源:StartSchedulerFiller.cs

示例9: RedirectWithStatusCode

 private static void RedirectWithStatusCode(HttpResponseBase response, HttpStatusCode statusCode, string url)
 {
     response.StatusCode = (int)statusCode;
     response.Redirect(url);
 }
開發者ID:Iristyle,項目名稱:Authentic,代碼行數:5,代碼來源:FileHttpHandler.cs

示例10: HandleRequestLocationException

        public static bool HandleRequestLocationException(Exception exception, BlogRequest blogRequest, IInstallationManager installManager, HttpResponseBase response)
        {
            if (blogRequest == null || (blogRequest.RequestLocation != RequestLocation.Installation &&
               blogRequest.RequestLocation != RequestLocation.Upgrade))
            {
                if (installManager.InstallationActionRequired(VersionInfo.CurrentAssemblyVersion, exception))
                {
                    response.Redirect("~/install/default.aspx", true);
                    return true;
                }
            }

            if (blogRequest.RequestLocation != RequestLocation.SystemMessages)
            {
                if (exception.GetType() == typeof(BlogInactiveException))
                {
                    response.Redirect("~/SystemMessages/BlogNotActive.aspx", true);
                    return true;
                }
            }
            return false;
        }
開發者ID:rsaladrigas,項目名稱:Subtext,代碼行數:22,代碼來源:Global.asax.cs

示例11: FillResponse

 public void FillResponse(HttpResponseBase response, HttpContextBase context)
 {
     _schedulerProvider.Scheduler.Shutdown(false);
     response.Redirect("/CrystalQuartzPanel.axd");
 }
開發者ID:JustAGhosT,項目名稱:CrystalQuartz,代碼行數:5,代碼來源:StopSchedulerFiller.cs

示例12: FillResponse

 public void FillResponse(HttpResponseBase response, HttpContextBase context)
 {
     DoAction(response, context);
     response.Redirect(context.Request.UrlReferrer.OriginalString);
 }
開發者ID:sdancer,項目名稱:crystal-quartz,代碼行數:5,代碼來源:OperationFiller.cs

示例13: Authorize

 public void Authorize(HttpResponseBase response, string callbackUrl)
 {
     string _target = string.Format("{0}?client_id={1}&redirect_uri={2}",
         BASE_AUTHENTICATION_URL, AppId, callbackUrl);
     response.Redirect(_target);
 }
開發者ID:ChristianChabtini,項目名稱:NET-Facebook-API,代碼行數:6,代碼來源:FacebookAPI.cs

示例14: Redirect

        internal static void Redirect(HttpResponseBase response, string url)
        {
            string redirectUrl;

            if (StrixPlatform.CurrentCultureCode.ToLower() == StrixPlatform.DefaultCultureCode.ToLower())
            {
                redirectUrl = string.Format("~/{0}", url);
            }
            else
            {
                redirectUrl = string.Format("~/{0}/{1}", StrixPlatform.CurrentCultureCode, url);
            }

            response.Redirect(redirectUrl);
        }
開發者ID:StrixIT,項目名稱:StrixIT.Platform,代碼行數:15,代碼來源:Helpers.cs


注:本文中的System.Web.HttpResponseBase.Redirect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。