0

This is based on the answer here to a similar question.

My code looks like this:

string url = Url.Action("Details", "Home", new RouteValueDictionary(new { Area = "MyArea", id = Id }), HttpContext.Request.Url.Scheme, HttpContext.Request.Url.Authority);

However, the resulting url contains double port number like this:

http://localhost:54383:54383/MyArea/Home/Details/1

The url should be:

http://localhost:54383/MyArea/Home/Details/1
Patee Gutee
  • 292
  • 2
  • 19
  • You're saying `Url.Action` is creating a URL with the port number duplicated? Are you doing any kind of string operations on `url` after that line to insert a port number? –  Dec 14 '18 at 20:59
  • yes port number is duplicated and no there's no other string operations. – Patee Gutee Dec 14 '18 at 21:05

1 Answers1

3

Try this it will work fine

 string url = Url.Action("Details", "Home", new { Area = "MyArea", id = Id }, HttpContext.Request.Url.Scheme);
Ahmed Ghoniem
  • 661
  • 1
  • 8
  • 15