J. Petersen February 2016

The URL will not let me to add order and description

This is how I should have added an order idea and description for payment on the home. but when I debugger URL gives me error as it provides added order and description of the URL.

var order = DateTime.Now.Year + Helper.Settings.NyTal(4);
var description = "&description=Medlemskab";
var client = new RestClient("http://api.blabla.net/subscriptions?currency=dkk&order_id=" + order + description);

Answers


Gabe February 2016

        var order = DateTime.Now.Year + Helper.Settings.NyTal(4);
        var description = "&description=Medlemskab";
        var request = string.Format("http://api.blabla.net/subscriptions?currency=dkk&order_id={0}{1}", order, description);
        var client = new RestClient(request);

See if that works, if it doesn't I'll delete this. Might just be a conversion issue as you're trying to append an int to string directly without converting it beforehand.

Alternatively:

var order = DateTime.Now.Year + Helper.Settings.NyTal(4); //.ToString()
var description = "&description=Medlemskab";
var client = new RestClient("http://api.blabla.net/subscriptions?currency=dkk&order_id=" + order.ToString() + description);

Whatever floats your boat. As I said, I'll delete this if I'm wrong.

Post Status

Asked in February 2016
Viewed 1,019 times
Voted 13
Answered 1 times

Search




Leave an answer