Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have a class that creates a Virtual Director and some other stuff with IIS 6.0, now I did the same with the ServerManager class to do the same with IIS 7x. We need to be compatible with both IIS in the same utility. (without using the compatibility with IIS 6)
The problem is that in IIS 6 machines the Microsoft.Web.Administration assembly does not exist. I know it's not possible to have it because the dll only comes with IIS 7.

What's the best way to do this?

Thanks!..
Posted

1 solution

I don't see the problem here. Your first version targets IIS 6, correct? So that one will not be using the IIS 7 specific classes anyway. So why don't you just use that same code with IIS 7 too?

[Update]
~~~~~~~~~

In response to your comment.

If the two versions of IIS require two different assemblies/classes to manage programmatically, then there's no way you can expect a single piece of code to handle this.

One approach to simplify your design would be to have two separate DLLs, one for IIS6 and one for IIS7. Have both implement a common interface. And your main application will always access these DLLs via this common interface, and at runtime, you decide to load either one of these DLLs depending on what version of IIS is installed on the target machine.
 
Share this answer
 
v3
Comments
luisnike19 21-Feb-11 21:54pm    
No, because the same code does not work with IIS 7.0,
IIS7 Microsoft.Web.Administration[http://msdn.microsoft.com/en-us/library/microsoft.web.administration(v=vs.90).aspx] a new API handles this IIS 7.
And the problem is that this API only exits in the pc that has IIS 7x.
Any idea? Thanks
Nish Nishant 21-Feb-11 21:59pm    
Check my updated answer.
luisnike19 16-Mar-11 10:57am    
Thanks for your reply. But I chose another option to handle this problem. I used Late binding with Reflection to do all the stuff with IIS 7x. It was more code to create all the objects, collections, methods and all that, but at least I could do it with just one assembly. That was the requierement.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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