472,958 Members | 2,514 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

IE Browser Proxy issue - NetworkStream HTML Images

Hi all, I have a real bugger of a problem that I just haven't been able to figure
out. I am working on writing my own proxy server in C# using TcpListener,
TcpClient, HttpWebRequest/Response and NetworkStream. I have everything
working pretty well except images won't load to their location.

------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------

The Rundown:
Run my proxy.exe file
Open up IE 7, point browser to www.google.com
Browser's GET request intercepted by the proxy
Proxy goes to google, returns initial page to browser
Browser sees that it needs to get two images
Sends these GET requests to proxy who sends them to appropriate google location
IE Browser screen knows the size and location of images, but they are not displayed

------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Command Line output:
C:\ProxyServer.exe
Waiting for a connection...
Browser Connected!
Received: GET http://www.google.com/ HTTP/1.0
Accept: */*
Accept-Language: en-us
UA-CPU: x86
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322 ; .NET CLR 2.0.50727)
Host: www.google.com
Pragma: no-cache
Cookie: testcookie=;

*LENGTH: 339
*END RECEIVE from browser*
Connecting to Site: 'http://www.google.com/'
**FILE EXTENSION: 'com/'
RESPONSE LENGTH = -1
RESPONSE TYPE = text/html; charset=ISO-8859-1
STATUS CODE = OK
About to write to Browser
Browser Stream Written
Closed Connection

Browser Connected!
*GETTING NEXT ITEM
Received: GET http://www.google.com/intl/en_ALL/images/logo.gif HTTP/1.0
Accept: */*
Referer: http://www.google.com/
Accept-Language: en-us
UA-CPU: x86
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322 ; .NET CLR 2.0.50727)
Pragma: no-cache
Host: www.google.com
Cookie: testcookie=;

*LENGTH: 399
*END RECEIVE from browser*
Connecting to Site: 'http://www.google.com/intl/en_ALL/images/logo.gif'
**FILE EXTENSION: 'gif'
RESPONSE LENGTH = 8558
RESPONSE TYPE = image/gif
STATUS CODE = OK
About to write to Browser
Browser Stream Written
Closed Connection

Browser Connected!
*GETTING NEXT ITEM
Received: GET http://www.google.com/images/nav_logo3.png HTTP/1.0
Accept: */*
Referer: http://www.google.com/
Accept-Language: en-us
UA-CPU: x86
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322 ; .NET CLR 2.0.50727)
Pragma: no-cache
Host: www.google.com
Cookie: testcookie=;

*LENGTH: 392
*END RECEIVE from browser*
Connecting to Site: 'http://www.google.com/images/nav_logo3.png'
**FILE EXTENSION: 'png'
RESPONSE LENGTH = 6336
RESPONSE TYPE = image/png
STATUS CODE = OK
About to write to Browser
Browser Stream Written
Closed Connection
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Where the output says Browser Stream written, that printout is after my NetworkStream.write()
to the browser client.

The RESPONSE LENGTH printouts are the actual size in bytes if I download
these images from a different browser not using a proxy. So I am getting the
correct response size, whereas with the plain html pages I was getting
RESPONSE LENGTH = -1 yet they were printed to my IE browser
(that code means that it doesn't know the exact size of the item)

I know this is so winded, I just like to be precise upfront. If anyone knows
anything about why this is a problem, I'd greatly appreciate any help.
I think it has something to do with string / image / byte arrays but have gone
down what it seems like every avenue with regard to it so...

Any help at all is greatly appreciated. If you have any questions or would like to
see source just let me know.

Thanks a bunch
Nick
Jun 6 '07 #1
0 1411

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Fuzzyman | last post by:
In a nutshell - the question I'm asking is, how do I make a socket conenction go via a proxy server ? All our internet traffic has to go through a proxy-server at location 'dav-serv:8080' and I...
6
by: Alex Rast | last post by:
First of all, this is not a programming question. I'm a user, not programming in JavaScript. I'm not, however, a novice user or even a power user - I certainly know programming intimately as well...
14
by: Gérard Talbot | last post by:
I personally disagree with the Viewable in Any browser campain. The site is frankly outdated, seems to be no longer maitained, has several recommendations that don't make a lot of sense anymore. In...
4
by: WATYF1 | last post by:
Hello. I'm writing a VB.NET app to check email message counts for both POP3 and IMAP4. I'm using TCPClient to connect, and a NetworkStream to send simple commands. It's a very simple bit of code,...
2
by: Ken Varn | last post by:
I have a control that I developed that uses a custom HTTPModule to dynamically render images to a web page using ASP.NET. It works most of the time with one exception. For some reason, Internet...
0
by: ian | last post by:
Hello, I have a small test.aspx page with an HtmlInputFile class instance and an imagebutton. When I run this on our proxy server and click the save imagebutton I get the "Page cannot be...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
3
by: JDS | last post by:
So, I'd like to create the following scenario: 1) Use cURL library within PHP (cURL + "Cookie Jar", et.al) to create a virtual browser session that "logs in" to a remote site. (For example: ...
1
by: jonathanellis | last post by:
Hello: I am having a problem with a web site that i built not showing up properly in IE6. I haven't tested it in IE7, but I have tested it in Firefox and Safari. Both Firefox and Safari show the...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.