0

I cant find what is wrong, why I have System.UriFormatException

string url = Url.Action("SendConfirmationEmail", new { orderid = newOrderDDD.ID.ToString()});
BackgroundJob.Enqueue(() => MyHelpers.CallUrl(url));

And this is my helper that I use

public static void CallUrl(string serviceUrl)
{
    var req = HttpWebRequest.Create(serviceUrl);
    req.GetResponseAsync();
}

So, what am I doing wrong?

diiN__________
  • 7,393
  • 6
  • 42
  • 69
cyprian
  • 497
  • 1
  • 6
  • 21
  • 1
    I suspect that `HttpWebRequest.Create` does not support a relative uri. You should inspect the exception in the debugger for the details of the exception. – Silvermind May 11 '16 at 09:47
  • 1
    this might help : http://stackoverflow.com/questions/2005367/getting-full-url-of-action-in-asp-net-mvc – Ehsan Sajjad May 11 '16 at 09:50
  • so how get correct url – cyprian May 11 '16 at 09:50
  • It work, thank a lot - string url = this.Url.Action("SendConfirmationEmail", "Cart", new { orderid = newOrderDDD.ID.ToString()}, this.Request.Url.Scheme); – cyprian May 11 '16 at 09:59

0 Answers0