TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nick
NA
4
0
NetworkStream HTML Image to IE browser (proxy)
Jun 6 2007 2:28 PM
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, just not
displayed
---------------------------------------------------------------------
---------------------------------------------------------------------
Command Line output: C:\Documents and Settings\nick\My Documents\Visual Studio
2005\Projects\LinkSele ctProxy\LinkSelectProxy>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
---------------------------------------------------------------------
---------------------------------------------------------------------
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. 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 it. 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.
Thanks a bunch Nick
Reply
Answers (
0
)
C# code from a C Library(DLL Import)
Tabindex not working with TableLayoutPanel