当我在Web服务器上收到请求时,帮助我获取请求字符串
这是我的代码:
[Route("membersave/{name}/{username}/{email}/{token}")]
public class MemberSave : Controller {
public TokContext _context { get; set; }
public MemberSave([FromServices] TokContext context) {
_context = context;
}
[HttpGet]
public bool Get_Member_Save(string name, string username, string email, string token) {
return DataAccess.Member_Save(_context.Database.GetDbConnection().ConnectionString, name, username, email, token);
}
}
我希望得到像myip/membersave/John&Wick/wick/johnwick@gmail.com/603D3163-DCCA-4FC2-8F85-9A2F94F9A725
我需要将所有请求保存到db
答案 0 :(得分:4)
您可以获得这样的请求路径:
var path = HttpContext.Request.Path.Value;