本文整理汇总了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();
}
}
示例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);
}
示例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));
}
示例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);
}
示例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();
}
}
示例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;
}
示例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);
}
示例8: FillResponse
public void FillResponse(HttpResponseBase response, HttpContextBase context)
{
_schedulerProvider.Scheduler.Start();
response.Redirect(context.Request.UrlReferrer.OriginalString);
}
示例9: RedirectWithStatusCode
private static void RedirectWithStatusCode(HttpResponseBase response, HttpStatusCode statusCode, string url)
{
response.StatusCode = (int)statusCode;
response.Redirect(url);
}
示例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;
}
示例11: FillResponse
public void FillResponse(HttpResponseBase response, HttpContextBase context)
{
_schedulerProvider.Scheduler.Shutdown(false);
response.Redirect("/CrystalQuartzPanel.axd");
}
示例12: FillResponse
public void FillResponse(HttpResponseBase response, HttpContextBase context)
{
DoAction(response, context);
response.Redirect(context.Request.UrlReferrer.OriginalString);
}
示例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);
}
示例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);
}