Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 24th, 2007, 01:07 PM
Authorized User
 
Join Date: Jul 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get source code from any URL

Is there any object or function in ASP.NET which could fetch me the source code of the page from its URL?
 
Old August 24th, 2007, 01:31 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

If you mean to get the source code for any URL you could possible think of, no, you cant do that. (Not to mention you would be violating the IP rights of the site owner.) If you mean to get the source code of any file you have locally, then that is just a script that will read through the filesystem which isn't to hard.

**By IP I mean Intellectual Property not Internet Protocol
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old August 24th, 2007, 09:16 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you mean the output HTML of a url, sure you can do that. You can use the WebRequest class to make a web request to any URL and retrieve the resulting HTML response. This is commonly referred to as "screen scraping".

-Peter
 
Old August 25th, 2007, 12:41 AM
Authorized User
 
Join Date: Jul 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Screen scraping must be using source code to render the corresponding html, then isn't there any way to get the source in txt format, I mean in a string variable?

 
Old August 25th, 2007, 10:20 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Mmmk. YOu need to be clear on what you want.

If you want the contents of a .cs or .vb file (or any server side code that may be included in a .aspx file) there is no way for you to get this code since every request you make to a particular URL will cause IIS to process the file.

If all you want is the resulting output of a given URL, as Peter said, you can use WebRequest to make a request to a given URL and then the Response stream that comes back you can place into a string variable eventually.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old August 25th, 2007, 01:27 PM
Authorized User
 
Join Date: Jul 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you both! My problem has been solved...:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Button code to call URL Zozozo BOOK: Beginning ASP 3.0 0 June 11th, 2007 08:06 AM
help me for the source code abdul_owiusa C# 0 July 28th, 2004 10:08 AM
source code abdul_owiusa C# 0 July 28th, 2004 10:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.