1

I want to change Local path in the Home Directory tab of the Default Website in IIS, programmatically from the C# code.

Mamta D
  • 6,310
  • 3
  • 27
  • 41
  • what are you trying to do ? i dont think you are in the right way – Royi Namir Oct 20 '11 at 08:29
  • I want to change the localpath that exists in the home directory tab of the iis – Hanuj Reddy Oct 20 '11 at 08:30
  • yeah I understood that , but what is you e scenarios which you need to deal with ? cause I really dont think you should do so( if possible ). – Royi Namir Oct 20 '11 at 08:32
  • Actually I am doin a project which configures entire application in which I need to configure iis also and thats y i need to do it programatically – Hanuj Reddy Oct 20 '11 at 08:34
  • any reason you can't use something like MSDeploy? it will configure IIS, app pools, locations, vdirs, etc... MSDeploy walkthrough - http://msdn.microsoft.com/en-us/library/dd465322.aspx. Walkthrough using generated .cmd file - http://msdn.microsoft.com/en-us/library/ff356104.aspx – Gary.S Oct 20 '11 at 08:40
  • we can also change it using directory entry right?? – Hanuj Reddy Oct 20 '11 at 08:48
  • Did you manage to find a solution, would be good to know how you did it? – Mark Redman Aug 18 '12 at 13:09

2 Answers2

0

There are managed APIs to deal with IIS, see John's asnwer here: IIS API - Create virtual directories? for an example and also here: Creating a new website programmatically on IIS using ASP.NET and C# the body of the method: CreateWebsite.

both are examples and should be adapted but a good starting point to show you how to interact with IIS from .NET / C#

Community
  • 1
  • 1
Davide Piras
  • 43,984
  • 10
  • 98
  • 147