Skip to content

WebClient.DownloadString() ->> GetConfig() is returning 403 #8

@ThePhOeNiX810815

Description

@ThePhOeNiX810815

I have changed code and it's working fine, TLS issue.

public T GetConfig<T>(string url)
{
	using (WebClient webClient = new WebClient())
	{
		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

		var data = webClient.DownloadString(url);
		var xmlSerializer = new XmlSerializer(typeof(T));
		using (var reader = new StringReader(data))
		{
			return (T)xmlSerializer.Deserialize(reader);
		}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions