你可以自己定义你的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. Memento Mori (二维前缀和 + 枚举剪枝)

    枚举指的是枚举矩阵的上下界,然后根据p0, p1, p2的关系去找出另外的中间2个点.然后需要记忆化一些地方防止重复减少时间复杂度.这应该是最关键的一步优化时间,指的就是代码中to数组.然后就是子矩阵 ...

  2. golang学习笔记8 beego参数配置 打包linux命令

    golang学习笔记8 beego参数配置 打包linux命令 参数配置 - beego: 简约 & 强大并存的 Go 应用框架https://beego.me/docs/mvc/contro ...

  3. GUI颜色、字体设置对话框

    %颜色设置对话框 uisetcolor %c 红色 c=uisetcolor %默认规定颜色 c=uisetcolor([ ]); %设置曲线颜色 h = plot([:]); c = uisetco ...

  4. JustOj 1927: 回文串

    题目描述 回文串是从左到右或者从右到左读起来都一样的字符串,试编程判别一个字符串是否为回文串. 输入 输入一个字符串.串长度<255. 输出 判别输入的字符串是否为回文串,是输出"Y& ...

  5. python sqlite3 数据库操作

    python sqlite3 数据库操作 SQLite3是python的内置模块,是一款非常小巧的嵌入式开源数据库软件. 1. 导入Python SQLite数据库模块 import sqlite3 ...

  6. [转载]DLL命名规则

    程序集是一个部署单元,同时还代表托管代码程序的身份.一般来说一个程序集仅与一个DLL相对应.本节主要讲DLL命名约定,程序集的命名约定与此类似. 要记住,名字空间与DLL和程序集是不同的概念.名字空间 ...

  7. jsp与后台交换数据(安全目录外)

    function changebasin(rivername,codepollute){ $.ajax({ type: "POST", url: "${ctx}/wate ...

  8. hibernate文档头的不同版本

    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "h ...

  9. Eloquent JavaScript #13# HTTP and Forms

    索引 Notes fetch form focus Disabled fields form’s elements property 阻止提交 快速插入单词 实时统计字数 监听checkbox和rad ...

  10. Python+selenium点击网页上指定坐标

    from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains dr = ...