Click here to Skip to main content
15,894,740 members
Please Sign up or sign in to vote.
2.67/5 (3 votes)
See more:
Does anyone have an idea of how to perform banner grabbing for any website using c# code?

I tried on cmd.exe using telnet command and was able to grab the banner information on the console itself but since it requires dummy enter presses for the result.
I am not able to redirect the result on the web browser.

Any alternative or links will be appreciable.

[edit]
Done using this:
C#
HttpWebResponse myHttpWebResponse = null;
                   try
                   {
                       myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                   }
                   catch (WebException ex)
                   {
                       myHttpWebResponse = (HttpWebResponse)ex.Response;
                   }
                   txtDisplay.Text = "\n\n"+ myHttpWebResponse.Headers.ToString().Replace("\r\n","\r\n\n");


[/edit]
:)

Thanks
Anurag :rose:
Posted
Updated 5-Jan-11 19:35pm
v5
Comments
DaveAuld 4-Jan-11 6:07am    
What do you mean by Banner Grabbing, which content exactly are you trying to grab? Give an example site and state the content.
Dalek Dave 4-Jan-11 6:56am    
Minor Edit for Readability.
@nuraGGupta@ 5-Jan-11 3:29am    
At the given below links, the information is shown, what I need from any website.
http://en.wikipedia.org/wiki/Banner_grabbing
http://www.articleswave.com/tutorials/basic-telnet-tutorial.html
@nuraGGupta@ 5-Jan-11 3:41am    
From the information given at above Wikipedia link, I am able to fetch all the information using httpWebResponse except :
1. ETag
for any website.

:-)

1 solution

I don't think Telnet or ftp fits your requirements.
Try wget from http://gnuwin32.sourceforge.net/packages.html[^]

Use the Process class to invoke wget from c#

Regards
Espen Harlinn
 
Share this answer
 
Comments
@nuraGGupta@ 5-Jan-11 7:55am    
Thanks, but I am not supposed to use any third party tool, doesn't matters its GNU or GPL. I have to write all code on my own(as I mentioned using c# code) . :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900