Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Resize textboxes Pin
Christian Graus5-Oct-07 0:36
protectorChristian Graus5-Oct-07 0:36 
QuestionSelect evet fires twice using ObjectDataSource GridView [modified] Pin
Nimua5-Oct-07 0:08
Nimua5-Oct-07 0:08 
QuestionIssue related with URL Pin
Malayil alex5-Oct-07 0:05
Malayil alex5-Oct-07 0:05 
AnswerRe: Issue related with URL Pin
Christian Graus5-Oct-07 0:07
protectorChristian Graus5-Oct-07 0:07 
AnswerRe: Issue related with URL Pin
N a v a n e e t h5-Oct-07 0:17
N a v a n e e t h5-Oct-07 0:17 
QuestionAccessing text file with URL Pin
Talal Sultan5-Oct-07 0:02
Talal Sultan5-Oct-07 0:02 
AnswerRe: Accessing text file with URL Pin
N a v a n e e t h5-Oct-07 0:22
N a v a n e e t h5-Oct-07 0:22 
AnswerRe: Accessing text file with URL Pin
Talal Sultan5-Oct-07 0:47
Talal Sultan5-Oct-07 0:47 
Hi,

Thanks for the hint Smile | :)

I found 2 ways to do the job. I will post them here maybe it would help others having the same problem.

Using your code, I found that if we use the DownloadString, it works too. We can write:

WebClient wc = new WebClient();
string s = wc.DownloadString("http://someserver.com/somefolder/myfile.txt");


this will put all the text file in s. We will get of course \r\n each time there is a new line.


Another method can be used which can allow us to read line by line:

WebRequest wRequest = HttpWebRequest.Create("http://someserver.com/somefolder/myfile.txt");
WebResponse wResponse = wRequest.GetResponse();
Stream myStream = wResponse.GetResponseStream();
StreamReader sr = new StreamReader(myStream);
string firstline = sr.ReadLine();


This is even better as we don't have to parse the string to remove the \r\n or other special characters.

Voila. Thanks again for the hint Smile | :)

-- If this is a post that has been helpful to you, please vote for it. Thank you!

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

GeneralRe: Accessing text file with URL Pin
N a v a n e e t h5-Oct-07 0:51
N a v a n e e t h5-Oct-07 0:51 
Questionvisible div Pin
venky4564-Oct-07 23:52
venky4564-Oct-07 23:52 
AnswerRe: visible div Pin
varshavmane5-Oct-07 0:14
varshavmane5-Oct-07 0:14 
GeneralRe: visible div Pin
venky4565-Oct-07 1:56
venky4565-Oct-07 1:56 
GeneralRe: visible div Pin
venky4565-Oct-07 1:57
venky4565-Oct-07 1:57 
AnswerRe: visible div Pin
Imran Khan Pathan5-Oct-07 0:27
Imran Khan Pathan5-Oct-07 0:27 
GeneralRe: visible div Pin
venky4565-Oct-07 1:55
venky4565-Oct-07 1:55 
QuestionHow to avoid button click event when the page refreshes? Pin
Madhuvan4-Oct-07 23:52
Madhuvan4-Oct-07 23:52 
AnswerRe: How to avoid button click event when the page refreshes? Pin
Christian Graus4-Oct-07 23:53
protectorChristian Graus4-Oct-07 23:53 
GeneralRe: How to avoid button click event when the page refreshes? Pin
Madhuvan5-Oct-07 0:41
Madhuvan5-Oct-07 0:41 
GeneralRe: How to avoid button click event when the page refreshes? Pin
Christian Graus5-Oct-07 0:51
protectorChristian Graus5-Oct-07 0:51 
AnswerRe: How to avoid button click event when the page refreshes? Pin
M_Menon5-Oct-07 0:12
M_Menon5-Oct-07 0:12 
GeneralRe: How to avoid button click event when the page refreshes? Pin
Christian Graus5-Oct-07 0:42
protectorChristian Graus5-Oct-07 0:42 
QuestionAmbiguous match found.? Pin
bug_aonz4-Oct-07 23:41
bug_aonz4-Oct-07 23:41 
AnswerRe: Ambiguous match found.? Pin
Christian Graus5-Oct-07 0:05
protectorChristian Graus5-Oct-07 0:05 
QuestionMSAcess database with password..., Pin
Member 38798814-Oct-07 22:59
Member 38798814-Oct-07 22:59 
AnswerRe: MSAcess database with password..., Pin
Abhijit Jana4-Oct-07 23:10
professionalAbhijit Jana4-Oct-07 23:10 

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.