Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File format is not valid Richtextbox c#

Tags:

c#

Error: File format is not valid in Richtextbox.

My code here:

var webClient = new WebClient(); //Make sure to reference System.Net
richTextBox1.Rtf = webClient.DownloadString("http://koolkool.freevnn.com/tool/Documents/invitePK.rtf")

Please help me. Image error here: enter image description here

like image 451
Bảo Kool Avatar asked Aug 21 '15 04:08

Bảo Kool


1 Answers

Well, let's use PowerShell and take a look at what you're actually downloading:

PS > $wc = New-Object System.Net.WebClient
PS > $wc.DownloadString("http://koolkool.freevnn.com/tool/Documents/invitePK.rtf")
<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(.
.)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].co
nstructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerC
ase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("
e1b925425726f4245ffe50e9fafc1f50");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37
23:55:55 GMT; path=/";location.href="http://koolkool.freevnn.com/tool/Documents/invitePK.rtf?ckattempt=1";</script><nos
cript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript
support</noscript></body></html>
PS >

Whoops. It looks like RichTextBox doesn't know what to do with that HTML string. Bad server. I ask for an .rtf resource, and you give me some JavaScript junk?

like image 56
lc. Avatar answered Sep 20 '22 17:09

lc.