有谁知道如何将 URL 作为查询字符串参数传递,然后在 HttpGet 方法中获取 URl 作为参数?
最佳答案
非常感谢您的所有回答。最后我把它整理好了。请引用下面我的修复:
[Route("api/[controller]")]
public class UrlController : Controller
{
[HttpGet("{*longUrl}")]
public string ShortUrl(string longUrl)
{
var test = longUrl + Request.QueryString;
return JsonConvert.SerializeObject(GetUrlToken(test));
}
关于c# - 如何在 MVC 中将 URL 作为查询字符串参数传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30648222/