当前位置: 首页>>代码示例>>C#>>正文


C# IRequest.GetParam方法代码示例

本文整理汇总了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;
        }
开发者ID:JackFong,项目名称:ServiceStack,代码行数:10,代码来源:ServiceStackHost.Runtime.cs

示例2: Execute

 public override void Execute(IRequest req, IResponse res, object requestDto)
 {
     req.Items["View"] = req.GetParam("View");
     req.Items["Template"] = req.GetParam("Template");
 }
开发者ID:vebin,项目名称:soa,代码行数:5,代码来源:ClientCanSwapTemplatesAttribute.cs

示例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;
        }
开发者ID:BilliamBrown,项目名称:ServiceStack,代码行数:34,代码来源:RazorPageResolver.cs

示例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();
            }
        }
开发者ID:jrmitch120,项目名称:ServiceStack,代码行数:42,代码来源:RazorPageResolver.cs


注:本文中的IRequest.GetParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。