Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

How do I use aspx to grab a page from another site


  • Please log in to reply
6 replies to this topic

#1 ThatBob

ThatBob

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:12:39 PM

Posted 30 April 2014 - 09:56 PM

I just need to grab the html of a page I run on another site and redisplay it through a site that uses ASP.net 4 and C#

 

I would prefer to not need to use any other modules added in.

 

Is there a way to do this?

 

I often use cURL in PHP for this, but that is not an option here.



BC AdBot (Login to Remove)

 


#2 ThatBob

ThatBob
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:12:39 PM

Posted 01 May 2014 - 11:28 PM

I found a page with the proper start code and built out from there.

<%@ page language="c#" %>
<%@ Import Namespace="System.Net" %>


<%
 string URL = "http://google.com";

WebClient myClient = new WebClient();
string webPageString = myClient.DownloadString(URL); 
%>

<%=webPageString %>

Now my problem is that I'm using this on an Internet facing server and it is grabbing content from systems behind the firewall. Each system takes just a few seconds to respond, but WebClient seems to be allowing this to happen only sequentially.

 

I am using iframes. THe server loads up the master page and then for each internal machine I query it loads up a different URL in an iframe.

 

When I do this using Apache/PHP it loads very fast becasue multiple iframes load at the same time.

When I do this on IIS 7.5 (Server 2008 R2 on a very capable VM) with aspx it seems to wait for one iframe to load then it goes to the next.

 

With 10 iframes it takes about 40 seconds while it is less than 10 for all of them in php.


Edited by ThatBob, 01 May 2014 - 11:29 PM.


#3 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:39 AM

Posted 01 May 2014 - 11:35 PM

Can you use other php, such as file_get_contents?



#4 ThatBob

ThatBob
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:12:39 PM

Posted 01 May 2014 - 11:53 PM

I would prefer to use PHP, and I do on all the machines it is querying, but I cannot install PHP on this server.

 

All the real work is happening elsewhere. this machine is just grabbing it and displaying it in iframes.



#5 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:10:39 AM

Posted 02 May 2014 - 12:03 AM

Is grabbing the content with javascript an option?



#6 ThatBob

ThatBob
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:12:39 PM

Posted 02 May 2014 - 12:31 AM

The Server 2008 R2 machine faces the Internet but all the machines it is querying are on the LAN.

 

When I visit example.com/get.aspx the server loads the pages from the systems on the LAN and then displays the data to me. I don't even have it transform the html.

 

But, to someone out on the Internet all the LAN machines are inaccessible behind the NAT router.



#7 ThatBob

ThatBob
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:12:39 PM

Posted 02 May 2014 - 12:33 AM

I think I found the proper solution.

 

I opened the Application Pool for that site and in advanced settings I set Maximum Worker Processes to 10.

 

I'm not sure if this will cause any problems with the primary application this server runs (It is the web facing portion of a database driven website)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users