你可以自己定义你的ASP.NET程序接收的get post put 或者delete请求。

使用这个约束的方式为:

void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
} public static void RegisterRoutes(RouteCollection routes)
{
string[] allowedMethods = { "GET", "POST" };
HttpMethodConstraint methodConstraints = new HttpMethodConstraint(allowedMethods); Route reportRoute = new Route("{locale}/{year}", new ReportRouteHandler());
reportRoute.Constraints = new RouteValueDictionary { { "httpMethod", methodConstraints } }; routes.Add(reportRoute);
}

参考资料: https://docs.microsoft.com/en-us/dotnet/api/system.web.routing.httpmethodconstraint?view=netframework-4.7.2

【ASP.NET】System.Web.Routing - HttpMethodConstraint Class的更多相关文章

  1. 【ASP.NET】System.Web.Routing - RouteCollection Class

    Provides a collection of routes for ASP.NET routing. The RouteCollection class provides methods that ...

  2. 【ASP.NET】System.Web.Routing - PageRouteHandler Class

    用于提供一些属性和方法来定义如何将URL匹配到一个物理文件上面. public PageRouteHandler (string virtualPath, bool checkPhysicalUrlA ...

  3. 【ASP.NET】System.Web.Routing - StopRoutingHandler Class

    Provides a way to specify that ASP.NET routing should not handle requests for a URL pattern. ex: rou ...

  4. 【ASP.NET】System.Web.Routing - Route Class

    Provides properties and methods for defining a route and for obtaining information about the route. ...

  5. 返璞归真 asp.net mvc (2) - 路由(System.Web.Routing)

    原文:返璞归真 asp.net mvc (2) - 路由(System.Web.Routing) [索引页] [源码下载] 返璞归真 asp.net mvc (2) - 路由(System.Web.R ...

  6. ASP.net 的URL路由选择(System.Web.Routing.dll)

    System.Web.Routing是.net 3.5sp1中新增的一个dll,用它提拱的类可以很方便的实现url的映射,在asp.net WebFrom的编程中可以使客户端请求的URL变得更加的&q ...

  7. 【ASP.NET】UCenter实现多站点同步登录退出

    利用UCenter实现discuz论坛和应用网站同步登录和退出功能 测试环境:Discuz! X3.2.UCenter 1.6..Net Framework 4.0 进入Discuz 后台的UCent ...

  8. 【ASP.NET】UCenter实现多站点同步注册

    问题描述 上一篇文章写了[ASP.Net]UCenter实现多站点同步登录退出 在整合论坛的时候,同步注册也是相当必要的一个功能:将论坛注册的用户同步到自己的网站,自己网站注册的用户同步到论坛. 官方 ...

  9. System.Web.Routing入门及进阶 下篇

    上面介绍的是最简单的一种定义方式.当然我们可以建立更复杂的规则.其中就包括设定规则的默认值以及设定规则的正则表达式. UrlRouting高级应用 预计效果: 当我访问/a/b.aspx时就会转到De ...

随机推荐

  1. GitHub 代码上传

    方法一 登录GitHub后,点击下面的图 New responsitory 按钮 或者点击绿色按钮 New repository,新建一个新建一个远程仓库(remote repository),点击后 ...

  2. Redis入门——安装与基本命令

    1. Redis安装 下载地址:https://github.com/MSOpenTech/redis/releases 下载zip文件后直接解压 2. 启动Redis服务端 解压目录下执行redis ...

  3. Spring源码阅读(三)

    上一讲我们谈到单例生产关键方法getSingleton.getSingleton方法由DefaultSingletonBeanRegistry类实现.我们的抽象工厂AbstractBeanFactor ...

  4. Vue:将px转化为rem,适配移动端vant-UI等框架(px2rem-loader)

    转载:https://www.cnblogs.com/WQLong/p/7798822.html 1.下载lib-flexible 使用的是vue-cli+webpack,通过npm来安装的 npm ...

  5. POJ 1789 Truck History (Kruskal 最小生成树)

    题目链接:http://poj.org/problem?id=1789 Advanced Cargo Movement, Ltd. uses trucks of different types. So ...

  6. AURO OtoSys IM100 vs Lonsdor K518ISE: which better?

    Comparison: AURO OtoSys IM100 and Lonsdor K518ISE It’s aimed to help make a purchase of decent auto ...

  7. 通过junit/TestNG+java 实现自动化测试

    第一步 安装JDK JDk1.7. 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-188026 ...

  8. 大数据学习路线:Zookeeper集群管理与选举

    大数据技术的学习,逐渐成为很多程序员的必修课,因为趋势也是因为自己的职业生涯.在各个技术社区分享交流成为很多人学习的方式,今天很荣幸给我们分享一些大数据基础知识,大家可以一起学习! 1.集群机器监控 ...

  9. 有道词典翻译(携带请求头和post参数请求)

    一.静态爬取页面信息 有道翻译网址:http://fanyi.youdao.com/ 在翻译中输入python 找到接口和请求的方式 参数是From Data类型 需要把参数数据转换为字典, 复制粘贴 ...

  10. ads查询结果中文显示方框问题

    刚安装aqua data studio查询结果中文会变成小方框 选择File -->Options 找到General  -->Appearance,把Editor Font , Text ...