• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# HttpVerbs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中HttpVerbs的典型用法代码示例。如果您正苦于以下问题:C# HttpVerbs类的具体用法?C# HttpVerbs怎么用?C# HttpVerbs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HttpVerbs类属于命名空间,在下文中一共展示了HttpVerbs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddEntryToList

 private static void AddEntryToList(HttpVerbs verbs, HttpVerbs match, List<string> verbList, string entryText)
 {
     if ((verbs & match) != 0)
     {
         verbList.Add(entryText);
     }
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:7,代码来源:AcceptVerbsAttribute.cs


示例2: DynamicApiActionInfo

 /// <summary>
 /// 初始化一个新的<see cref="DynamicApiActionInfo"/>实例
 /// </summary>
 /// <param name="actionName">Action 名称</param>
 /// <param name="verb">HTTP Verb</param>
 /// <param name="method">一个方法信息,随着 Action 的调用而调用</param>
 /// <param name="filters">用于 Controller Action 的动态筛选器</param>
 public DynamicApiActionInfo(string actionName, HttpVerbs verb, MethodInfo method, IFilter[] filters = null)
 {
     ActionName = actionName;
     Verb = verb;
     Method = method;
     Filters = filters ?? new IFilter[] { };
 }
开发者ID:yangganggood,项目名称:EMP,代码行数:14,代码来源:DynamicApiActionInfo.cs


示例3: CheckForBindingInPutOperations

 protected static void CheckForBindingInPutOperations(HttpVerbs requestVerb)
 {
     if (requestVerb == HttpVerbs.PUT)
     {
         throw DataServiceException.CreateBadRequestError(System.Data.Services.Strings.BadRequest_CannotUpdateRelatedEntitiesInPut);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:Deserializer.cs


示例4: RESTFulActionConstraint

        /// <summary>
        /// Initializes a new instance of the <see cref="RESTFulActionConstraint"/> class.
        /// </summary>
        /// <param name="httpVerb">The HTTP verb.</param>
        /// <param name="requiresId">if set to <c>true</c> [requires id].</param>
        public RESTFulActionConstraint(HttpVerbs httpVerb, bool requiresId)
        {
            HttpVerbs = httpVerb;
            RequiresId = requiresId;

            verbs = ConvertToStringList(HttpVerbs);
        }
开发者ID:nomit007,项目名称:Core,代码行数:12,代码来源:RESTfulActionConstraint.cs


示例5: Users

        public PartialViewResult Users(HttpVerbs? method, int? page, int? sizePage)
        {
            var model = new ModelTestApiResult();

            // if 'Get'
            if(method == HttpVerbs.Get)
            {
                // start the timer
                var timer = Stopwatch.StartNew();

                // perform the call
                List<UserV2> users;
                var response = LicenceManager.TryListUsers(out users);

                // stop the timer
                timer.Stop();
                model.ElapsedMilliseconds = timer.ElapsedMilliseconds;

                // get the content
                model.Users = users;
                // get the code
                model.ResponseBody = response.GetBodyAsString();
                // get the exception message
                model.Message = response.MessageError;
                // get the status code
                model.StatusCode = response.StatusHttp;
            }
                // if method is not supported
            else
                model.Message = "Method not supported";

            return this.PartialView("Result", model);
        }
开发者ID:ChezMose,项目名称:LicenceToBill.DotNet,代码行数:33,代码来源:TestApiController.cs


示例6: GetRestsharpMethod

        private Method GetRestsharpMethod(HttpVerbs method)
        {
            Method result;

            switch (method)
            {
                case HttpVerbs.Get:
                    result = Method.GET;
                    break;
                case HttpVerbs.Post:
                    result = Method.POST;
                    break;
                case HttpVerbs.Put:
                    result = Method.PUT;
                    break;
                case HttpVerbs.Patch:
                    result = Method.PATCH;
                    break;
                case HttpVerbs.Delete:
                    result = Method.DELETE;
                    break;
                case HttpVerbs.Head:
                    result = Method.HEAD;
                    break;
                default:
                    result = Method.GET;
                    break;
            }

            return result;
        }
开发者ID:JannethAmaya,项目名称:RestAPIClientGenerator,代码行数:31,代码来源:GenericAPICall.cs


示例7: RunPostExecutionFilters

 private static void RunPostExecutionFilters(IAction action, HttpVerbs httpVerb) {
     var filters = GetFilters(action, httpVerb);
     filters.ForEach(x => {
                         x.Context = action.Context;
                         x.AfterExecute();
                     });
 }
开发者ID:szp11,项目名称:Martin,代码行数:7,代码来源:ActionInvoker.cs


示例8: ValidateAntiForgeryTokenWrapperAttribute

 public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs)
 {
   this._verbs = new AcceptVerbsAttribute(verbs);
   this._validator = new ValidateAntiForgeryTokenAttribute()
   {
     Salt = Consts.AntiForgeryToken
   };
 }
开发者ID:clpereira2001,项目名称:Lelands-Master,代码行数:8,代码来源:ValidateAntiForgeryTokenWrapperAttribute.cs


示例9: ApiDocumentationAttribute

		public ApiDocumentationAttribute( String url, String description = "", Type returnType = null, HttpVerbs requestType = HttpVerbs.Get, Type formBody = null )
		{
			Url = url;
			Description = description;
			ReturnType = returnType;
			RequestType = requestType;
			FormBody = formBody;
		}		
开发者ID:gandarez,项目名称:SwaggerAPIDocumentation,代码行数:8,代码来源:ApiDocumentationAttribute.cs


示例10: ClientPreference

 /// <summary>
 /// Initializes a new instance of the <see cref="ClientPreference"/> class.
 /// </summary>
 /// <param name="requestDescription">The request description.</param>
 /// <param name="verb">The request verb.</param>
 /// <param name="requestMessage">The request message.</param>
 /// <param name="effectiveMaxResponseVersion">The effective max response version for the request, which is the min of MDSV and MPV.</param>
 public ClientPreference(RequestDescription requestDescription, HttpVerbs verb, IODataRequestMessage requestMessage, Version effectiveMaxResponseVersion)
     : this(InterpretClientPreference(requestDescription, verb, requestMessage))
 {
     if (effectiveMaxResponseVersion >= VersionUtil.Version4Dot0)
     {
         this.annotationFilter = requestMessage.PreferHeader().AnnotationFilter;
     }
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:15,代码来源:ClientPreference.cs


示例11: ValidateAntiForgeryTokenWrapperAttribute

 public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs, string salt)
 {
     this._verbs = new AcceptVerbsAttribute(verbs);
     this._validator = new ValidateAntiForgeryTokenAttribute()
     {
         Salt = salt
     };
 }
开发者ID:ankit-defacto,项目名称:PSS,代码行数:8,代码来源:ValidateAntiForgeryTokenWrapperAttribute.cs


示例12: DoRequest

        public string DoRequest(string query, HttpVerbs method, Action<Stream> data, string contenttype)
        {

            Stream stream = DoDataRequest(query, method, data, contenttype);
            System.IO.StreamReader sr = new StreamReader(stream, Encoding.UTF8);

            return sr.ReadToEnd();
        }
开发者ID:tocsoft,项目名称:Common.Helpers,代码行数:8,代码来源:RestClient.cs


示例13: BuildForm

 public static HtmlTag Form
     (this HtmlHelper html, string actionName, string controllerName, RouteValueDictionary routeValues,
      HttpVerbs method)
 {
     var action = UrlHelper.GenerateUrl
         (null, actionName, controllerName, routeValues, html.RouteCollection,
          html.ViewContext.RequestContext, true);
     return BuildForm(action, method);
 }
开发者ID:ivanbokii,项目名称:Enjoy.Templates,代码行数:9,代码来源:FormExtensions.cs


示例14: CustomValidateAntiForgeryTokenAttribute

        /// <summary>
        /// Initializes a new instance of the <see cref="CustomValidateAntiForgeryTokenAttribute"/> class.
        /// </summary>
        /// <param name="verbs">The verbs.</param>
        /// <param name="salt">The salt.</param>
        public CustomValidateAntiForgeryTokenAttribute(HttpVerbs verbs, string salt)
        {
            Verbs = verbs;
            Salt = salt;

            AcceptVerbsAttribute = new AcceptVerbsAttribute(Verbs);
            Validator = new ValidateAntiForgeryTokenAttribute
            {
                Salt = Salt
            };
        }
开发者ID:iHunt101,项目名称:POS-1,代码行数:16,代码来源:CustomValidateAntiForgeryTokenAttribute.cs


示例15: EnumToArray

        internal static string[] EnumToArray(HttpVerbs verbs) {
            List<string> verbList = new List<string>();

            AddEntryToList(verbs, HttpVerbs.Get, verbList, "GET");
            AddEntryToList(verbs, HttpVerbs.Post, verbList, "POST");
            AddEntryToList(verbs, HttpVerbs.Put, verbList, "PUT");
            AddEntryToList(verbs, HttpVerbs.Delete, verbList, "DELETE");
            AddEntryToList(verbs, HttpVerbs.Head, verbList, "HEAD");

            return verbList.ToArray();
        }
开发者ID:nobled,项目名称:mono,代码行数:11,代码来源:AcceptVerbsAttribute.cs


示例16: BaseAuthorizationProvider

 public BaseAuthorizationProvider(HttpContextBase hcb)
 {
     Context = hcb;
     var rdv = ((MvcHandler)Context.CurrentHandler).RequestContext.RouteData.Values;
     Httpverb = (HttpVerbs)(Enum.Parse(typeof(HttpVerbs), Context.Request.GetHttpMethodOverride(), true)); // returns actual method if no override specified.
     // assumes specific Resources will be accessed by Id (see BaseResourceModel)
     // _id = rdv.ContainsKey("Id") ? rdv["Id"].ToString() : "";
     Controller = rdv["controller"].ToString();
     Action = rdv["action"].ToString();
     //var n = _context.User.Identity.Name;
     Init();
 }
开发者ID:dglass,项目名称:cts-public,代码行数:12,代码来源:BaseAuthorizationProvider.cs


示例17: Route

 private void Route(string action, HttpVerbs verb)
 {
     var actionName = action.ToLowerInvariant();
     if (!_actions.ContainsKey(action))
         _actions[actionName] = new[] { verb };
     else
     {
         var verbs = _actions[actionName].ToList();
         verbs.Add(verb);
         _actions[actionName] = verbs.ToArray();
     }
 }
开发者ID:jewer,项目名称:restful-routing,代码行数:12,代码来源:AdditionalAction.cs


示例18: ConvertVerbs

        private static ReadOnlyCollection<string> ConvertVerbs(HttpVerbs verbs)
        {
            ReadOnlyCollection<string> verbsAsCollection;
            if (_verbsToVerbCollections.TryGetValue(verbs, out verbsAsCollection))
            {
                return verbsAsCollection;
            }

            verbsAsCollection = new ReadOnlyCollection<string>(EnumToArray(verbs));
            _verbsToVerbCollections.TryAdd(verbs, verbsAsCollection);
            return verbsAsCollection;
        }
开发者ID:RhysC,项目名称:aspnetwebstack,代码行数:12,代码来源:HttpVerbsValidator.cs


示例19: For

        public static RouteData For(this RouteCollection routes, HttpVerbs verb, string url)
        {
            var httpContext = MockRepository.GenerateStub<HttpContextBase>();
            var httpRequest = MockRepository.GenerateStub<HttpRequestBase>();
            httpContext.Stub(x => x.Request).Return(httpRequest);

            httpRequest.Stub(r => r.Headers).Return(new NameValueCollection());
            httpRequest.Stub(r => r.PathInfo).Return(string.Empty);
            httpRequest.Stub(r => r.AppRelativeCurrentExecutionFilePath).Return(url);
            httpRequest.Stub(r => r.HttpMethod).Return(Enum.GetName(typeof(HttpVerbs), verb));

            return routes.GetRouteData(httpContext);
        }
开发者ID:tylermercier,项目名称:mvc_template,代码行数:13,代码来源:RouteExtensions.cs


示例20: Route

 private void Route(string resource, string action, HttpVerbs verb)
 {
     var actionName = RouteSet.LowercaseActions ? action.ToLowerInvariant() : action;
     if (!_actions.ContainsKey(action))
         _actions[actionName] = new KeyValuePair<string,HttpVerbs[]>(resource, new[] { verb });
     else
     {
         var keyValue = _actions[actionName];
         var verbs = keyValue.Value.ToList();
         verbs.Add(verb);
         _actions[actionName] = new KeyValuePair<string,HttpVerbs[]>(keyValue.Key, verbs.ToArray());
     }
 }
开发者ID:radischevo,项目名称:restful-routing,代码行数:13,代码来源:AdditionalAction.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HttpWebRequest类代码示例发布时间:2022-05-24
下一篇:
C# HttpTransportBindingElement类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap