473,811 Members | 3,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

host headers c# add programmaticall y

we need to add host headers to a IIS site (not default one)

in .NET/c#

we can print host headers but cannot insert programmaticall y new one

bellow is our code

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

if (TemplSite.Sche maClassName == "IIsWebServ er")

{

Console.WriteLi ne(TemplSite.Na me);

Console.WriteLi ne(TemplSite.Pr operties["ServerComm ent"].Value.ToString ());

object[] hosts = (object[])TemplSite.Prop erties["ServerBindings "].Value;
foreach(string host in hosts)

{

Console.WriteLi ne(host);

}
///// DOES NOT WORK

ArrayList hostsList = new ArrayList(hosts );

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

object[] newhosts = hostsList.ToArr ay();
TemplSite.Prope rties["ServerBindings "].Value = (object)newhost s;
}

Thanks

GSL
Nov 19 '05 #1
0 1186

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1458
by: Andy | last post by:
Hello Group: How would I go about connecting to an IIS server and getting a list of the host headers for a certain web-site? I am not sure where to begin or how to go about doing this. I have tried some google searches, but nothing so far is helping. Thanks Andy
3
1534
by: Karl Easterly | last post by:
Hi. I have a site running with a FQDN which is addressed using host headers. Instead of working with the project through a mapped drive, I would like to work with it via the concept implied as 'open->project from web'. I have no problem working with it via the mapped drive, even debuggin is fine. I am sure it is a simple setting I need to toggle, but I do not know which. I tried web sharing the folder but when I open in this mannor I
1
2635
by: Dan Sikorsky | last post by:
Under the File menu, Page Setup item in the IE is a way to setup the Page headers and footers the show when you print a page in the browser. How can we set those programmatically in a webform? -- Thank you kindly, Dan Sikorsky BAB, BScE, MSC
3
2983
by: Tim_Mac | last post by:
hi, see quote below from http://groups.google.ie/groups?hl=en&lr=&th=36c5d2df211a4d78&seekm=00480961-660F-462D-BBD4-455C8DA26C38%40microsoft.com&frame=off According to the book: "Deploying .NET Applications Lifecycle Guide" published in Microsoft Press: "Web setup projects allow you to specify which port to install the application on, they do not currently support deployment of a Web application to a site differentiated by host...
2
2636
by: suchismita.83 | last post by:
Hi, I want to fetch host header of a site url but not getting idea how to do that. Can we do by using HttpRequest.ServerVariables. I have searched in net but not getting the member through which we can fetch the hosturl using these "servervariables". Can anyone help me out how to fetch the root level url of a site. TIA
0
924
by: Gabriel Genellina | last post by:
En Mon, 14 Apr 2008 01:04:40 -0300, Penny Y. <pylists@arcor.deescribió: Add a `headers` parameter to the request method. See http://docs.python.org/lib/httpconnection-objects.html Something like this (untested): headers = {'Host', 'the.host.name'} conn = httplib.HTTPConnection("192.168.1.1") conn.request("GET", "/", headers=headers)
10
2614
by: AAaron123 | last post by:
I want to create a database with one table on the host. I can't user SQL Server Management Studio to do it so I guess I have to do it programmatically. I have in mind that in the session start (or maybe application start would be better) I'd check to see it the database exists and if not create it. The problem is that I have no idea how to do that.
7
4975
by: lmeyers | last post by:
I implemented a URL rewriter which worked reasonably well, but now I am creating other sites on the same server (single IP). Because IIS will not accept subdomain wildcards (*.subdomain.com), it resolves the subdomain traffic back to the default site (e.g. the site with empty host header). From there it is possible to rewrite and pass the traffic back to correct web app and use the referring agent to get original url, but this gets messy in...
0
2450
by: teddarr | last post by:
I have a Windows Server 2003. I am trying to run multiple websites on the server. I am using host headers to run the websites on only one ip address. Before anyone says this is an iis issue and in the wrong forum, Please note that I have tested all the host header settings with a simple hello world html file and everything works great. I get a runtime error that tells me to change custom errors to "Off". The main problem is that custom...
0
9734
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
10652
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
10395
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...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
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
6895
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
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.