473,657 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE Browser Proxy issue - NetworkStream HTML Images

7 New Member
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.w rite()
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 1463

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

Similar topics

4
17691
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 need to make a socket connection through it. The reason (with code example) is as follows : I am hacking "Tiny HTTP Proxy" by SUZUKI Hisao to make an http proxy that modifies URLs. I haven't got very far - having started from zero knowledge of...
6
2268
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 as computer hardware, configuration, etc... down to the lowest level (e.g. BIOS, assembly language, etc). Anyway, I've obviously got something wrong with JavaScript configuration, files, etc. in Windows 2000, Service Pack 3, because on sites...
14
2349
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 my mind, it is much more important to code according to standards (valid markup and CSS code) and good coding practices (tableless design, graceful degradation, etc.) than to code according to the lower common denominator among browsers. ...
4
4462
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, actually... the problem is, if the user is behind a proxy, then the Connect method fails (times out). How do I get around this? I thought this would be a common issue and that there would be plenty of code out there to demonstrate how to...
2
1529
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 Explorer does not always display the images even though the image has been sent successfully. I sometimes have to right click on the image and select "Show Image" and then the image appears. This is totally random. I can refresh the screen and...
0
932
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 displayed" error screen. I'm not sure how to fix this because it doesn't happen all the time. The weird thing is that if I make it a button instead of an image it works fine. OR if I delete the image (/images/save.jpg) then it works also. It doesn't...
15
2820
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. Everything is the default settings I believe. IIS is running under Local System. In IIS the DefaultAppPool is running under Network Service. Annonymous access uses the account IUSR_JASMINE (machine name is Jasmine).
3
10356
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: here: http://curl.haxx.se/libcurl/php/examples/cookiejar.html and here: http://curl.haxx.se/libcurl/php/examples/ebay_login.html
1
2136
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 website perfectly. Can anyone help with this? I have attached the source code for the index.html file and the style.css file. In addition to the script, I also have this uploaded to my server. It can be found at:...
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.