Using a dash (-) in ASP.MVC parameters

后端 未结 5 1470
失恋的感觉
失恋的感觉 2020-12-05 08:26
<% using (Html.BeginForm(\"SubmitUserName\")) { %>
    
    
<         


        
5条回答
  •  执念已碎
    2020-12-05 09:08

    Not answering the actual question based on the technlogy in question, but anyway, the world moves forward in some areas; in AspNetCore.Mvc you can simply do:

        [HttpGet()]
        public ActionResult SubmitUserName( [FromHeader(Name = "user-Name")] string userName) {...}
    

提交回复
热议问题