400 Bad request on c# code

Tags: c# bad-request
Question!

Getting an error exception thrown on this small piece of code but I can't figure out why / where. Fairly new to this so any help would be apprecaited

private void GetServiceData(string url)
{
    try
    {
        if (!string.IsNullOrEmpty(this.Service) && !string.IsNullOrEmpty(url))
        {
            string data = string.Empty;
            string name = string.Format("{0}Data", this.Service);

            using (WebClient client = new WebClient())
            {
                data = client.DownloadString(url);
            }

            Page.ClientScript.RegisterHiddenField(name, data);
        }
    }
    catch (Exception ex)
    {
        Shared.Utilities.ExceptionLog.WriteExceptionToLog(ex, "CourseFinderServiceControl.GetServiceData()");
    }
}


Answers

If this is for Twitch, you need to specify client when requesting the data.



This video can help you solving your question :)
By: admin