Click here to Skip to main content
15,911,531 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to share dll? Pin
bneacetp6-Jun-04 23:49
bneacetp6-Jun-04 23:49 
GeneralRe: how to share dll? Pin
khchan7-Jun-04 5:10
khchan7-Jun-04 5:10 
GeneralRe: how to share dll? Pin
Heath Stewart7-Jun-04 5:42
protectorHeath Stewart7-Jun-04 5:42 
GeneralRe: how to share dll? Pin
LongRange.Shooter8-Jun-04 4:34
LongRange.Shooter8-Jun-04 4:34 
Generalwhich class can analyse HTTP. Pin
Xytme6-Jun-04 23:09
Xytme6-Jun-04 23:09 
GeneralRe: which class can analyse HTTP. Pin
Heath Stewart7-Jun-04 4:52
protectorHeath Stewart7-Jun-04 4:52 
GeneralRe: which class can analyse HTTP. Pin
Xytme7-Jun-04 15:58
Xytme7-Jun-04 15:58 
GeneralRe: which class can analyse HTTP. Pin
Heath Stewart8-Jun-04 2:43
protectorHeath Stewart8-Jun-04 2:43 
Then just do simple line parsing? Use a StringReader and loop through the lines. Split the line on the first colon found:
StringDictionary lookup = new StringDictionary();
using (StringReader reader = new StringReader(httpString))
{
  string methodAndRequest = reader.ReadLine();
  if (methodAndRequest != null)
  {
    line = reader.ReadLine();
    while (line != null)
    {
      // If the line is only a newline (as defined for HTTP), break.
      if (line == "\r\n") break;
 
      string[] header = line.Split(new char[] {':'}, 1);
      if (header.Length == 2)
        lookup.Add(header[0].Trim(), header[1].Trim());
    }
  }
}
// Get the value of the Host: header
Console.WriteLine(lookup["Host"]);
It's a simple parsing algorithm. If you want, you could further break-down known headers to typed classes or whatever you want to do.

 

Microsoft MVP, Visual C#
My Articles
QuestionWich user control is on top? Pin
Klok6-Jun-04 22:59
Klok6-Jun-04 22:59 
AnswerRe: Wich user control is on top? Pin
bneacetp6-Jun-04 23:14
bneacetp6-Jun-04 23:14 
AnswerRe: Wich user control is on top? Pin
Stefan Troschuetz6-Jun-04 23:47
Stefan Troschuetz6-Jun-04 23:47 
GeneralRe: Wich user control is on top? Pin
Klok7-Jun-04 0:01
Klok7-Jun-04 0:01 
GeneralRe: Wich user control is on top? Pin
Klok7-Jun-04 1:39
Klok7-Jun-04 1:39 
GeneralRe: Wich user control is on top? Pin
Stefan Troschuetz7-Jun-04 2:13
Stefan Troschuetz7-Jun-04 2:13 
GeneralDataGrid row colour settings based on contents Pin
ma.poggi-cons6-Jun-04 22:08
ma.poggi-cons6-Jun-04 22:08 
GeneralRe: DataGrid row colour settings based on contents Pin
Jay Shankar6-Jun-04 22:35
Jay Shankar6-Jun-04 22:35 
QuestionHow Can I Access the WAB with C# Pin
Member 9020256-Jun-04 20:24
Member 9020256-Jun-04 20:24 
AnswerRe: How Can I Access the WAB with C# Pin
Heath Stewart7-Jun-04 5:18
protectorHeath Stewart7-Jun-04 5:18 
GeneralCOM+ Word Object Error Pin
Member 3350226-Jun-04 20:15
Member 3350226-Jun-04 20:15 
QuestionHow to build my own database? Pin
fu06-Jun-04 17:04
fu06-Jun-04 17:04 
AnswerRe: How to build my own database? Pin
Aryadip6-Jun-04 20:31
Aryadip6-Jun-04 20:31 
AnswerRe: How to build my own database? Pin
Heath Stewart7-Jun-04 4:48
protectorHeath Stewart7-Jun-04 4:48 
GeneralExcel datetime Pin
Daniel Foo Chee Kwan6-Jun-04 16:25
Daniel Foo Chee Kwan6-Jun-04 16:25 
GeneralRe: Excel datetime Pin
Heath Stewart7-Jun-04 5:12
protectorHeath Stewart7-Jun-04 5:12 
QuestionHow do I get to the main form Pin
6-Jun-04 16:17
suss6-Jun-04 16:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.