Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: URL Stream


Message #1 by <kshatdalpriya@i...> on Fri, 21 Mar 2003 14:18:02 +0530
Hi friends,
 I want to read ASPX file from WebClient method. But it returns error
"System.Net.WebException: The remote server returned an error: (404) Not
Found." The file all ready present there. Is there any other method to
read the ASPX file. But when I replace
("http://192.168.0.16/AddEditFormGenerator.aspx") to
("http://www.yahoo.com") , then It works fine.
*************** Code ********************************			
			WebClient myWebClient = new WebClient();
			Stream myStream 
myWebClient.OpenRead("http://192.168.0.16/AddEditFormGenerator.aspx");
			StreamReader sr = new StreamReader(myStream);
			//Response.Write(sr.ReadToEnd());
			string filePath
@"d:\projects\CodeGenerator\GeneratedCode\AddEdit.txt";
			FileStream fs = new FileStream(filePath,
FileMode.OpenOrCreate, FileAccess.ReadWrite);
			StreamWriter w = new StreamWriter(fs);
			w.BaseStream.Seek(0, SeekOrigin.End);
			w.Write(sr.ReadToEnd());
			myStream.Close();
*************** Code ********************************			
Thanks in advenced.
Shatdal Priya


  Return to Index