does anyone know how to pass a URL as a query string parameter and then get the URl in HttpGet method as a parameter ?
Thanks so much for all the answers. Finally I got it sorted. Please refer to my fix below:
[Route("api/[controller]")]
public class UrlController : Controller
{
[HttpGet("{*longUrl}")]
public string ShortUrl(string longUrl)
{
var test = longUrl + Request.QueryString;
return JsonConvert.SerializeObject(GetUrlToken(test));
}
just like this?
<a href="/Home/[email protected]("http://stackoverflow.com")">current url with UrlEncode</a>
[HttpGet]
public ActionResult Index(string url = null)
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
return View();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With