Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,

I really need to get some information from an specific website, but I can't.
My code works for other websites but not for this. It return some bad symbols. I think it's because of website security, but I'm not very well in web application :(
Is there any one who knows what is the problem?
Thanks,
Posted
Updated 24-Feb-15 16:29pm
v2
Comments
saad_lah 24-Feb-15 17:33pm    
Could you please provide some details? a patch of code?
Member 10875659 24-Feb-15 17:55pm    
For example I used this code:

HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://www.tsetmc.com/Loader.aspx?ParTree=15");
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string result = sr.ReadToEnd();
sr.Close();
myResponse.Close();
Console.WriteLine(result.ToString());

and some of other types of code but they return bad symbols. And also I used webbrowser control in c# to navigate the site, which is written by asp, but it couldn't browse the website!!
saad_lah 24-Feb-15 19:08pm    
Its encoding problem...You have to detect the encoding of the language and then use that encoding parameter in StreamReader to get correct result.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900