Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
QuestionPrinting documents Pin
msx236-Nov-08 12:18
msx236-Nov-08 12:18 
AnswerRe: Printing documents Pin
DaveyM696-Nov-08 13:09
professionalDaveyM696-Nov-08 13:09 
AnswerRe: Printing documents Pin
Giorgi Dalakishvili6-Nov-08 22:23
mentorGiorgi Dalakishvili6-Nov-08 22:23 
QuestionCustom TextBox Text property default value Pin
DaveyM696-Nov-08 11:38
professionalDaveyM696-Nov-08 11:38 
AnswerRe: Custom TextBox Text property default value Pin
leppie6-Nov-08 23:01
leppie6-Nov-08 23:01 
GeneralRe: Custom TextBox Text property default value Pin
DaveyM696-Nov-08 23:23
professionalDaveyM696-Nov-08 23:23 
AnswerRe: Custom TextBox Text property default value [modified] Pin
DaveyM697-Nov-08 9:07
professionalDaveyM697-Nov-08 9:07 
QuestionProblem with downloading html from the web with httpwebrequest object Pin
Haim Nachum6-Nov-08 10:56
Haim Nachum6-Nov-08 10:56 
hi.


im trying to download html text from 'amazon.com' using this method:

<br />
 HttpWebRequest hRequest = (HttpWebRequest)WebRequest.Create(url);<br />
            hRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*";<br />
            hRequest.ContentType = "application/x-www-form-urlencoded";<br />
            hRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; InfoPath.2)";<br />
            hRequest.Headers.Add("Accept-Encoding", "gzip, deflate"); <br />
            hRequest.Headers.Add("UA-CPU", "x86");<br />
            hRequest.Method = "GET";<br />
<br />
            HttpWebResponse hResponse = (HttpWebResponse)hRequest.GetResponse();<br />
            StreamReader s =new StreamReader(hResponse.GetResponseStream(),Encoding.GetEncoding(hResponse.CharacterSet));<br />
<br />
<br />
  string page = s.ReadToEnd();<br />
<br />


i know that amazon uses character set of "iso-8859-1", thats also returned by the httpwebresponse.characterset property.

but for some reason when i examine the string it contains scrambled charecters, so when i want to search that text using all sort of string methods it dosent work.

however if i use the "webclinet" object downloadstring method to retrieve the page it shows up fine, but it also takes him 30 sec to get the string!
i dont know if its like that because of a heavy processing or something else, but its not flexible enough and dosent answer my needs.

anyone have an idea why im getting an invalid string?
AnswerRe: Problem with downloading html from the web with httpwebrequest object Pin
leppie6-Nov-08 22:51
leppie6-Nov-08 22:51 
GeneralRe: Problem with downloading html from the web with httpwebrequest object Pin
Haim Nachum6-Nov-08 22:59
Haim Nachum6-Nov-08 22:59 
AnswerRe: Problem with downloading html from the web with httpwebrequest object Pin
RGiroux3211-Jan-09 16:51
RGiroux3211-Jan-09 16:51 
QuestionDiffrent behaviour Pin
bsaksida6-Nov-08 9:45
bsaksida6-Nov-08 9:45 
AnswerRe: Diffrent behaviour Pin
PIEBALDconsult6-Nov-08 10:28
mvePIEBALDconsult6-Nov-08 10:28 
GeneralRe: Diffrent behaviour Pin
Pete O'Hanlon6-Nov-08 10:45
mvePete O'Hanlon6-Nov-08 10:45 
GeneralRe: Diffrent behaviour Pin
bsaksida6-Nov-08 11:04
bsaksida6-Nov-08 11:04 
QuestionModify HtmlDocument Pin
OptiPlex6-Nov-08 8:18
OptiPlex6-Nov-08 8:18 
AnswerRe: Modify HtmlDocument Pin
Anthony Mushrow6-Nov-08 9:22
professionalAnthony Mushrow6-Nov-08 9:22 
GeneralRe: Modify HtmlDocument Pin
OptiPlex6-Nov-08 21:29
OptiPlex6-Nov-08 21:29 
QuestionCodeDom Problem,Script Application communication with Host Application? Pin
legalbattle6-Nov-08 6:46
legalbattle6-Nov-08 6:46 
AnswerRe: CodeDom Problem,Script Application communication with Host Application? [modified] Pin
Pedram Behroozi6-Nov-08 7:37
Pedram Behroozi6-Nov-08 7:37 
GeneralRe: CodeDom Problem,Script Application communication with Host Application? Pin
legalbattle6-Nov-08 14:27
legalbattle6-Nov-08 14:27 
QuestionDrawing a string without scaling the font size? [modified] Pin
DigiFaith6-Nov-08 3:31
DigiFaith6-Nov-08 3:31 
GeneralRe: Drawing a string without scaling the font size? Pin
Guffa6-Nov-08 8:09
Guffa6-Nov-08 8:09 
AnswerRe: Drawing a string without scaling the font size? Pin
Anthony Mushrow6-Nov-08 9:13
professionalAnthony Mushrow6-Nov-08 9:13 
Questionto execute command at command prompt from .net C# application Pin
sailesh_gupta6-Nov-08 3:02
sailesh_gupta6-Nov-08 3:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.