3

The following code:

        WebClient WC = new WebClient();
        WC.Encoding = Encoding.UTF8;
        string Url = "http://www.tsetmc.com/tsev2/data/instinfodata.aspx?i=59266699437480384&c=64";
        return WC.DownloadString(Url);

code returns:

�Q�T�MP�J�A|�^D����~���C�"�����l� ��;I&3=j=�iG�H9Ȓ�J�^� �j��T�Q=HH�'Qm�������1�hF�4�*�������{�x�\o?

when I visit that URL in any web browser, I get:

12:29:45,A ,3540,3567,3600,3621,3690,3515,140,238204,849582597,1,20140914,122945;;1@2825@3523@3583@1700@1,1@2000@3522@3600@8700@2,1@500@3511@3640@2500@1,;19774,99736,1

is there any way to get right string?

also, i use this online Decoder, but i dont get right anwser: Universal Online Decoder

Community
  • 1
  • 1
Saleh Bagheri
  • 424
  • 4
  • 19

2 Answers2

0

This should work:

    WebClient WC = new WebClient();
   // WC.Encoding = Encoding.UTF8;
    string Url = "http://www.tsetmc.com/tsev2/data/instinfodata.aspx?i=59266699437480384&c=64";
    return Encoding.UTF8.GetString(WC.DownloadString(Url));
StartCoding
  • 394
  • 5
  • 16
  • Sorry! this code did not work correctly! the result is wrong yet! – Saleh Bagheri Sep 15 '14 at 09:11
  • try another Encoding as well. Atleast one will work for you. eg: Encoding.Default.GetString(). Check your serverside encoding too. – StartCoding Sep 15 '14 at 11:06
  • thanks, i try all available Encoding (ASCII, Default, Unicode, ...) but it doesn't work! i think this result given because of an unknown Security Block of that Website! – Saleh Bagheri Sep 15 '14 at 13:35
0

use Uri Object as argument in DownloadString method:

var url =String.Format("http://www.tsetmc.com/tsev/data/instinfodata.aspx?i=59266699437480384&c=64");

var WC = new WebClient { Encoding = Encoding.UTF8 };

return WC.DownloadString(new Uri(url));

BELotfi
  • 51
  • 1
  • 3