本文整理汇总了C#中IResponse.RedirectToUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IResponse.RedirectToUrl方法的具体用法?C# IResponse.RedirectToUrl怎么用?C# IResponse.RedirectToUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResponse
的用法示例。
在下文中一共展示了IResponse.RedirectToUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override void Execute(IRequest req, IResponse res, object requestDto)
{
if (SkipIfDebugMode && HostContext.Config.DebugMode)
return;
if (!req.IsSecureConnection)
{
if (SkipIfXForwardedFor)
{
var httpReq = req as IHttpRequest;
if (httpReq != null && httpReq.XForwardedFor != null)
return;
}
res.RedirectToUrl(req.AbsoluteUri.AsHttps());
res.EndRequest();
}
}
示例2: DoHtmlRedirect
public static void DoHtmlRedirect(string redirectUrl, IRequest req, IResponse res, bool includeRedirectParam)
{
var url = req.ResolveAbsoluteUrl(redirectUrl);
if (includeRedirectParam)
{
var absoluteRequestPath = req.ResolveAbsoluteUrl("~" + req.PathInfo + ToQueryString(req.QueryString));
url = url.AddQueryParam(HostContext.ResolveLocalizedString(LocalizedStrings.Redirect), absoluteRequestPath);
}
res.RedirectToUrl(url);
}
示例3: DoHtmlRedirectIfConfigured
protected bool DoHtmlRedirectIfConfigured(IRequest req, IResponse res, bool includeRedirectParam = false)
{
var htmlRedirect = this.HtmlRedirect ?? AuthenticateService.HtmlRedirect;
if (htmlRedirect != null && req.ResponseContentType.MatchesContentType(MimeTypes.Html))
{
var url = req.ResolveAbsoluteUrl(htmlRedirect);
if (includeRedirectParam)
{
var absoluteRequestPath = req.ResolveAbsoluteUrl("~" + req.PathInfo + ToQueryString(req.QueryString));
url = url.AddQueryParam(HostContext.ResolveLocalizedString(LocalizedStrings.Redirect), absoluteRequestPath);
}
res.RedirectToUrl(url);
return true;
}
return false;
}
示例4: Execute
public override void Execute(IRequest req, IResponse res, object requestDto)
{
if (req.QueryString.Count > 0)
{
res.RedirectToUrl(req.PathInfo);
}
}