Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > host headers c# add programmatically

Reply
Thread Tools

host headers c# add programmatically

 
 
greg
Guest
Posts: n/a
 
      12-21-2004
we need to add host headers to a IIS site (not default one)

in .NET/c#

we can print host headers but cannot insert programmatically new one



bellow is our code

DirectoryEntry TemplSite = new DirectoryEntry("IIS://LocalHost/w3svc/6");

if (TemplSite.SchemaClassName == "IIsWebServer")

{

Console.WriteLine(TemplSite.Name);

Console.WriteLine(TemplSite.Properties["ServerComment"].Value.ToString());

object[] hosts = (object[])TemplSite.Properties["ServerBindings"].Value;


foreach(string host in hosts)

{

Console.WriteLine(host);

}


///// DOES NOT WORK

ArrayList hostsList = new ArrayList(hosts);

hostsList.Add(":80:qqqqqq2.com");

object[] newhosts = hostsList.ToArray();


TemplSite.Properties["ServerBindings"].Value = (object)newhosts;


}

Thanks

GSL


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with wsgiref.headers.Headers Phil Python 4 01-17-2010 04:47 PM
Server cannot clear headers after HTTP headers have been sent Ian ASP .Net Security 2 03-20-2007 09:00 AM
HOWTO: Programmatically Setup IE Page Headers and Footers Dan Sikorsky ASP .Net 1 11-16-2004 07:54 PM
Reading 'received' headers: Email Headers Parsing dont bother Python 0 03-03-2004 08:18 PM
HowTo 'open->project from web', with host headers in place Karl Easterly ASP .Net 3 08-20-2003 09:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57