当前位置: 首页>>代码示例>>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;未经允许,请勿转载。