本文整理汇总了C#中IRequest.GetParam方法的典型用法代码示例。如果您正苦于以下问题:C# IRequest.GetParam方法的具体用法?C# IRequest.GetParam怎么用?C# IRequest.GetParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRequest
的用法示例。
在下文中一共展示了IRequest.GetParam方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasValidAuthSecret
public bool HasValidAuthSecret(IRequest httpReq)
{
if (Config.AdminAuthSecret != null)
{
var authSecret = httpReq.GetParam("authsecret");
return authSecret == Config.AdminAuthSecret;
}
return false;
}
示例2: Execute
public override void Execute(IRequest req, IResponse res, object requestDto)
{
req.Items["View"] = req.GetParam("View");
req.Items["Template"] = req.GetParam("Template");
}
示例3: ExecuteRazorPage
public IRazorView ExecuteRazorPage(IRequest httpReq, IResponse httpRes, object model, RazorPage razorPage)
{
if (razorPage == null)
{
httpRes.StatusCode = (int)HttpStatusCode.NotFound;
return null;
}
var page = CreateRazorPageInstance(httpReq, httpRes, model, razorPage);
var includeLayout = !(httpReq.GetParam(QueryStringFormatKey) ?? "").Contains(NoTemplateFormatValue);
if (includeLayout)
{
var result = ExecuteRazorPageWithLayout(razorPage, httpReq, httpRes, model, page, () =>
httpReq.GetItem(LayoutKey) as string
?? page.Layout
?? DefaultLayoutName);
if (httpRes.IsClosed)
return result != null ? result.Item1 : null;
using (var writer = new StreamWriter(httpRes.OutputStream, UTF8EncodingWithoutBom))
{
writer.Write(result.Item2);
}
return result.Item1;
}
using (var writer = new StreamWriter(httpRes.OutputStream, UTF8EncodingWithoutBom))
{
page.WriteTo(writer);
}
return page;
}
示例4: ExecuteRazorPage
public IRazorView ExecuteRazorPage(IRequest httpReq, IResponse httpRes, object model, RazorPage razorPage)
{
if (razorPage == null)
{
httpRes.StatusCode = (int)HttpStatusCode.NotFound;
return null;
}
try
{
var page = CreateRazorPageInstance(httpReq, httpRes, model, razorPage);
var includeLayout = !(httpReq.GetParam(Keywords.Format) ?? "").Contains(Keywords.Bare);
if (includeLayout)
{
var result = ExecuteRazorPageWithLayout(razorPage, httpReq, httpRes, model, page, () =>
httpReq.GetItem(LayoutKey) as string
?? page.Layout
?? DefaultLayoutName);
if (httpRes.IsClosed)
return result != null ? result.Item1 : null;
var layoutWriter = new StreamWriter(httpRes.OutputStream, UTF8EncodingWithoutBom);
var html = HtmlFilter(result.Item2);
layoutWriter.Write(html);
layoutWriter.Flush();
return result.Item1;
}
var writer = new StreamWriter(httpRes.OutputStream, UTF8EncodingWithoutBom);
page.WriteTo(writer);
writer.Flush();
return page;
}
finally
{
RequestContext.Instance.ReleaseDisposables();
}
}