Last post Apr 30, 2008 02:09 AM by prash_dark
Feb 29, 2008 08:35 AM|prash_dark|LINK
Hi all, Hi have created a web deployment project for my web site. While installing, if we keep textbox provided for Virtual Directory name blank, it still proceeds with installation. I dont want that to happen. I want to make that field mandatory. But .net
doesn't allow that, it seems. So, i am trying to do it in my Custom Code. But I am not able to find any way to abort or rollback installation. No luck with "base.rollback()" method either.
Can some1 plz suggest anything? Thanks a lot in advance..
Mar 06, 2008 01:12 AM|Benson Yu - MSFT|LINK
I find your duplicate post in MSDN forum and the community member “amit_arora” has given you the solution that throws the InstallException. I agree with his point and the following sections are for your additional questions.
Can I abort or rollback installtion??
To set the physical directory path for web project deployment, you can refer to the following link.
Allow user to set physical directory path during Web Project deployment
So far, I don’t find a way to diable the “Next” button in the web setup dialog when the virutal directory textbox is empty. However, we can check the name of virutal directory in the overrided "Intall" menthod. If the value is empty, then throw
the InstallException. For example, please refer to the following code snippet (based on the sample project in the above codeproject link) which works on my machine.
' TODO: Search for the Server Number <-------?
Dim vRoot = GetObject("IIS://LocalHost/W3svc/1/Root")
' Create de Virtual Dir
If Me.Context.Parameters.Item("dir").Trim().Equals(String.Empty) Then
Throw New InstallException("Sorry, you inputted the empty virtual directory name which is not allowed, installation failed")
Dim vDir = vRoot.Create("IIsWebVirtualDir", Me.Context.Parameters.Item("dir"))
' Set the Physical Path for the virtual Dir
vDir.Path = DirLocation
Apr 30, 2008 02:09 AM|prash_dark|LINK
Thanks a lot for suggestions...