How to setup Windows authentication mode for a web application deployed using a web setup project ?

 Hi,

I would like to know if it is possible to set up the authentication mode to "Windows Authentication" for a web application deployed on IIS using a web setup project from Visual Studio 2005 and also how to do that. I know that after deploying the web application using the MSI file I can manually edit the security settings from the IIS and set the authentication mode to "Integrate Windows authentication", but I would like to do this at deploy time.

Since I was not able to do that, I tried an open-source project, Windows Installer XML v3.0 - this project eventually creates an MSI file, exactly as VS 2005 web setup  project will, but running the WiX MSI will create a web site inside IIS where the authentication mode is set to Windows. I have opened both MSI files using ORCA editor and the WiX generated MSI contains very specific IIS information (tables like IIsWebAddress, IIsWebApplication, IIsWebApplicationExtension, IIsWebDirProperties, IIsWebSite and IIsWebVirtualDir). The VS 2005 generated MSI contains none of these tables - the only table related to IIS I could find is _IISProperties.

Here is my development/deployment enviroment:
Windows XP Professional Edition, SP2 (IIS 5.1)
Visual Studio 2005 Professional Edition, SP1
.NET Framework 2.0


Thank you very much !

0
satrapu
11/6/2008 9:55:29 AM
asp.net.config-deploy 12495 articles. 0 followers. Follow

2 Replies
1014 Views

Similar Articles

[PageSpeed] 19

Take a look at www.iis.net and MSDeploy.

Jeff


Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
0
jeff
11/6/2008 1:20:06 PM

Hi Jeff,

 Thanks for your replay. Anyway, I have solved it using a custom action written in C# and adding it inside my web setup project at Install custom actions sections.

In order to make the custom action work as expected, please add the following line in the CustomActionData property: /VirtualDirectory="[TARGETVDIR]" /HostName="[ComputerName]".

 [RunInstaller(true)]
    public class IisIntegratedWindowsAuthenticationInstaller : Installer{
        private const string EVENT_LOG_SOURCE = "IisIntegratedWindowsAuthenticationInstaller";
        private const string HOST_NAME = "HostName";
        private const string VIRTUAL_DIRECTORY = "VirtualDirectory";

        /// <summary>
        ///
        /// </summary>
        /// <param name="stateSaver"></param>
        public override void Install(IDictionary stateSaver){
            base.Install(stateSaver);
            SetWindowsAuthenticationMode();
        }

        private void SetWindowsAuthenticationMode(){
            try{
                //uncomment the line bellow if you want to debug the code
                //(this class must be compiled using Debug configuration)
                //Debugger.Break();
                EventLog.WriteEntry(EVENT_LOG_SOURCE,
                    string.Format("Getting value from context parameter '{0}'", VIRTUAL_DIRECTORY));

                string virtualDirectory = Context.Parameters[VIRTUAL_DIRECTORY];

                EventLog.WriteEntry(EVENT_LOG_SOURCE,
                    string.Format("'{0}' = '{1}'", VIRTUAL_DIRECTORY, virtualDirectory));

                EventLog.WriteEntry(EVENT_LOG_SOURCE,
                    string.Format("Getting value from context parameter '{0}'", HOST_NAME));

                string hostName = Context.Parameters[HOST_NAME];

                EventLog.WriteEntry(EVENT_LOG_SOURCE,
                    string.Format("'{0}' = '{1}'", HOST_NAME, hostName));

                EventLog.WriteEntry(EVENT_LOG_SOURCE,
                    string.Format("Trying to set the web site {0} authentication mode to 'Windows authentication'", virtualDirectory));

                DirectoryEntry targetWebDirectoryEntry =
                    new DirectoryEntry(string.Format("IIS://{0}/W3SVC/1/Root/{1}", hostName, virtualDirectory));
                targetWebDirectoryEntry.InvokeSet("AuthFlags", new object[]{AuthenticationTypes.ReadonlyServer});
                targetWebDirectoryEntry.CommitChanges();

                EventLog.WriteEntry(EVENT_LOG_SOURCE,
                    string.Format("Web site {0} authentication mode was set to 'Windows authentication'", virtualDirectory));
            } catch(Exception ex){
                EventLog.WriteEntry(EVENT_LOG_SOURCE, string.Format("Error encountered: {0}\n{1}", ex.Message, ex.StackTrace),
                    EventLogEntryType.Error);
                throw;
            }
        }
    }
}

0
satrapu
11/10/2008 9:41:49 AM
Reply:

Similar Artilces:

Benefits of creating a Web Deployment project for a Setup project for a website vs a Web Setup project
I'm creating an installer for a website.The only thing I require as input from the user (in Custom Actions) is settings for the web.config. My initial approach was to create a Deployment project from my web project ans use this as input to the Setup project.Couldn't I use a Web Setup project instead of a Web Deployment + Setup project to do the same thing?Issues I have found with the Web Deployment is that I cannot edit it's contents at installation time, I'm taking user input at installation time to write to the web.config that the Installer uses but of course this file is embedded in the Web Deployment projects output (I don't think this can be edited once the Web Deployment project has been compiled, correct me if I'm wrong please!!!!!)  http://learnerps-dotnet.blogspot.com Hi, You can use a Web Deployment Project with a Web Setup Project. Create custom install actions in the Setup project and use the primary output of Web Deployment project. Since the custom actions will fire after the project has been physically deployed, there is no case of "modifying embedded" file as you will modify the file which is present in the user's installation directory. Hope this helps, VivekSocial Networking Platform in ASP.NET || Join now: CodeASP.NET Community Please mark the most helpful reply/replies as "Answer". I see, so the installation functionality works on the already installed website files, but is this not dictated by the developer pointing the functi...

Web Deployment Project / Setup Project and editable web.config
I'm working on an installer for a website. The Installer will prompt the user for the web settings such as as various AppSettings. How would you recommend implementing this? Below I describe my initial thoughts but they seem over complicated !!!! My first idea is to created the Web Deployment Project and create a web.config section overwrite file, and then using it in the usual manner to overwrite the web.config appSettings section at installation time.Property Pages->Deployment section to "appsettings=appsettings.config"Then to make this appsettings.config file editable by a Custom ...

How to deploy web project in VS 2005 using web setup project
I have developed a new .NET Web application in C#. It is working find in localhost, i want to deploy the application to the production server. Please let me know what are the steps i need to follow to create an MSI file with VS.NET Installer in VS 2005. When i am trying to create a websetup project with a new solution option, it is not giving me the primary output file selection, i mean to say i am not at all getting the list of resources to select in the drop down list and also my project in the projects drop down list. Please some boyd help me and tell me is there any thing need to be done...

Web setup project to deploy a Web application to a target server
I am working on Visual Studio 2005 web setup..I need to customize installation address, scenario is as follows:  I have web setup (.msi) on my machine..while installing the website, the setup is capturing current machine websites to install the website. I want to install the website on different server...I must be able give the IP address of my target server and expecting the websetup to install the website on target server. Only websetup .msi is available on my current machine, i also have the access to target machine. Is there any way that would do my requirement? Copy project, publish site will not do my requirement. I have to do installation only thru the websetup. Thanks In Advance, Chaits To my knowledge msi does not support installing on other machines than the current machine. If it's not an option to copy the msi file to the target machine and run it from there (which would definitely do the trick), you should perhaps look into SMS (System Management Server) technologies. SMS lets you install on remote machines, but I don't know how that fits your setup....

Web Deployment using 'Web Setup Project'
Hi All, In 'Other Project Types', I select 'Web Setup Project' so that I can have a windows installer for my website. Everything is working fine but I am not able to compress all of the code pages into a single dll so that users will not able to view it. Currently, my windows installer will show both xxxx.aspx and  xxxx.aspx.cs pages instead of only xxxx.aspx. Note: In the project output group section, the VS2005 only has 'Content Files'. There are no other selections. Does any one have a suggestion? Thanks for any feedback! Greatly appreciated. Cheers, Frank Frank, To c...

Using Web Setup project to deploy precompiled web site
Hello:I am trying to deploy a precompiled web site using a web setup project. I only wish to include the precompiled dlls, not any content files. I create a Web Setup Project. I do not include the content files for the website. I COULD manually add files to the file system editor by browsing to the folder that contains the precompiled dlls and add each dll. This would not be an ideal solution for two reasons:- Each time a new page gets created, one would have to manually go back and add its precomiled dll to the web setup project if the project isn't set to batch compile. If it is set to bat...

Web Setup Project versus Web Deployment Project
Is there some good article on when to use which project?Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". Hello, You could check here - http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx Actually you can easily configure the WebSetup project to pipe in the output from your WebSiteDeployment project into the MSI. RegardsWindows Hosting ASP.NET | Top ASP.NET Hosts | Dedicated Windows Hosting ThanxJohan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================...

deploy web application on SBS 2003 via Web Setup Project
Hi, I created a web set up project to deploy an ASP .NET application to SBS 2003, and I set the 'VirtualDirectory' to websetup1. When I run the setup application on a SBS 2003, it creates websetup1 relative to 'companyweb'. I want to create websetup1 relative to 'Default Web Sites'. How can I do it? Thanks....

Error when Deploying and Signing Web Application project with Web Deployment project
I have a Web Application project that needs to be deployed and signed using Web Deployment projects. When I delete the global.ascx file I'm able to do the deployment and sign the output assembly. The error I'm getting without signing the assemblies is "An error occurred when merging assemblies: ILMerge.Merge: The target assembly 'HelloWorld' lists itself as an external reference.” .  Global.ascx or .asax? The usual cause of a signing error is when a reference is not signed.  Is the global.asax.cs or .vb marked as conte...

Web Deployment Project deploying files not included by Web Application Project
Recently my boss asked me to find a way to share a web site project between 2 separate projects which will only share a subset of the files in the folder.  I created 2 web applications projects in the folder and eliminated the web site project.  I discovered when I publish the web application projects, that it wasn't compiling the .as*x pages, so I looked into web deployment projects.  The problem I'm having with web deployment projects is that when I build them from the solution configuration, it copies all the files in the web project to the deployment folder and I c...

Problems deploying Dynamic Data web application using "Web Deployment" project
Hi,  When I attempt to deploy a dynamic data web application using a "web deployment" project, only about half of the folders inside the "DynamicData" folder get copied properly. Here are the steps to reproduce. Prerequisites: Visual Studio 2008 .NET 3.5 SP1 Web Deployment projects add-on installed (I forget the exact name of this tool) In VS2008, go to File, New Project, Dynamic Data Web Application Right click on WebApplication1 and select "Add Web Deployment Project..." Accept the defaults and click OK. Right clik the web dep...

Deploy project using Web Setup Project
Is there any way to set the version of .Net that the virtual direstory uses? When the msi from the Web Setup Project creates the virtual directory it seems to just set the .Net version to the version that the web site that the vertual directory was installed under....

How to use web deployment projects with multiple web application projects.
I followed the guide on this page http://support.microsoft.com/kb/307467 "How To Create an ASP.NET Application from Multiple Projects for Team Development" and I now have my main app at the root of the application and I have all of the sub applications as sub directories of the root application.  It all works great when I do a normal debug build or a normal publish.  The problem is that I have nested sitemaps, nested master pages, and of course, nested web.config files.  Basically the root app has a master page, sitemap, and web.config file and each child app ...

so confused, different between Web Deployment Project and Web Setup Project
I am so confused. Want to know what is the different between Web Deployment Project and Web Setup Project. I have already completed a web application project. What am i going to use? Deployment or Setup?Thanks so much in advance!Justin so far i know both is useful.to get the best compile options use web deploy project.to install the web on other machine/deliver to user, use web setup project (that containing web deploy project output). Thanks Trance...

Web Setup Project: Web Service Deployment
Hi,   I created a c# web setup project to install/deploy my web service.  When I run the install project, then create a console application and tryto add web reference from local machine (to check my installation), I notice that there are 2 links to the web service:      1) http://localhost/TestWebSetup/TestWebService.asmx  //valid       2) http://localhost/TestWebSetup/TestWebSetup/TestWebService.asmx  //invalid, what is going on ??It should only be displaying the first link.  Does ...

pls, why do people use InstallShild for .Net applications deployement since VS2003 already includes setup & deployement projects
pls, why do people use InstallShild for .Net applications deployement since VS2003 already includes setup & deployement projects thanks for satisfying my curiousity:)Thanks a lot, I appreciate your taking the time to help me. Hello, Because the VS2003 deployment projects don't have as many functionalities as InstallShield. A simple example - from VS2003 deployment project you can't start the application automatically (or if user selects) after install. RegardsFlorin Antoci...

Web Deployment Project & Web Setup Project source code issue...
I seem to be having an issue using the deployment add-in and the web setup project as it pertains to the source code being included in the msi package... I have website that I have tried to deploy to a remote server where I need to run the msi installer.  it runs just fine, but includes the aspx.vb files for each page.  I have tried to follow the directions on MSDN, but they do not mirror the Visual Studio 2005 Web setup project on my machine.  Anyway, is there an option I am missing somewhere to NOT include the vb source files (code behind)?Warren LaFrance Hi Warren,&nbs...

Web Application Projects with Web Deployment Projects...
Hi there,  Does anyone have any experience in using the Web Deployment Project pieces to deploy Web Application style projects (rather than the web site projects model)? We have a rather larger eCommerce site that uses WAP model (it was originally a website model, but we ran into so many problems with compile times, temp .dll file lockups at compile etc that we moved it to WAP a long time ago). What's strange is that the project compiles fine normally when we're not using the Web Deployment Project and everything is fine. However, the second we hook the WDP stuff up, we'r...

Web Deployment Project with Web Application Project
I currently have a working Solution that contains 3 VB class library projects and one Web Application Project and it is working fine. I would like to use the web.config replacement functionality from the Web Deployment Projects. I add a Web Deployment project and keep the defaults, and the build is broken. Whenever I try to build, I get the following error: error ASPPARSE: Could not load type 'MyWebApp.Page1'. Done building project "MyWebApp.vbproj_deploy.wdproj" -- FAILED. I have searched on this and found some information, but it doesn't seem to help. I&#...

Web Deployment Project and Web Application Project
 Hi! Maybe I have missed something, but shouldn't there be possible to do a web deployment project of a web application project? I have followed this guide http://msdn2.microsoft.com/en-us/library/aa479568.aspx, but  I can't get it to work without building the web application project first. With TFSBuild it fails even if I build the web application first. The error looks like this: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v /WebDepWeb.csproj -p <MySourceFolder>\WebDepWeb -f <MySourceFolder>\WebDepBuild\Binaries\Release\_PublishedWebsi...

Web Application Project and Web Deployment Project
I went to http://msdn2.microsoft.com/en-us/asp.net/aa336619.aspx and downloaded the web deployment project. Installed it and tried to create a deployment project for my web application project. However, I do not get the menu item. I've tried this with existing WAP's, new WAP's, but no luck. I have VS 2005 team developer, with SP1 and Team Explorer installed.I've tried the steps mentioned through out this post: http://forums.asp.net/thread/1502324.aspx but still have no luck in getting the menu item.Any help would be appreciatedWayne...

Web Deployment of a Web Application:why the vbproj file is in the Web Deployment folder
Hello, I'm an old ASP and new ASP 1.1 developer.Now I have to work with ASP 2.0 and I'm testing the new features but there are things that are not clear.. I created a web application (converted from an ASP.NET 2.0 web site) and I was trying to build the web application project.These are the Property Pages Settings:Configuration:ReleaseCompilation: Allow this precompiled site to be updatable .. checkedOutput Assemblies: Merge all outputs to a single assembly  is checked                    ...

Web Setup Project
I have developed a web site that I now want to distribute and install on other computers. I have created a Setup project that builts a .CAB file with the contents of my site, but I don't know what to do next. I cannot find any documentation on the process of creating and installing ASP.NET web sites. I can write up some manual procedures, but isn't there a setup program of some sort that will create a web site, unpack my .CAB file and install it?  ...

Deploying Web Site using setup project
Hi, Is there a buit-in mechanism where I can prompt the user installing the web site for the database URL, username, and password that should be used in the web.config file?  I am trying to build a web site setup project for a site that utilizes a remote database server. Any help is appreciated!  Thanks! Mike ...

Web resources about - How to setup Windows authentication mode for a web application deployed using a web setup project ? - asp.net.config-deploy

Authentication - Wikipedia, the free encyclopedia
Authentication (from Greek : αὐθεντικός authentikos , "real, genuine," from αὐθέντης authentes , "author") is the act of confirming the truth ...

New Tools to Optimize App Authentication
At f8, we announced a redesigned Auth Dialog and a new authentication flow to give developers more control over people’s first experience with ...

Facebook Tells Some Developers They Have 48 Hours to Fix Authentication Data Leaks
... sent an email to what it calls a “very small percentage of the developer community” informing them their apps are suspected of leaking authentication ...

Lockdown - A better two-factor authentication experience on the App Store on iTunes
Get Lockdown - A better two-factor authentication experience on the App Store. See screenshots and ratings, and read customer reviews.


YouTube - How To Hack Twitter's New Two Factor Authentication
Veröffentlicht am 23.05.2013 Connect! http://toopher.com http://facebook.com/toopherinc http://twitter.com/toopher CEO Josh Alexander wants ...

SafeNet brings Cloud-based authentication service to A/NZ
SafeNet has released its new Cloud-based authentication service, billed as Authentication-as-a-Service, in A/NZ.

Two-factor authentication - cyber security -
Two recent hacking cases highlight how personal emails can impact overall business security through tiny weaknesses.

Digital authentication to become Google's next big focus
Streamlining the website login process a top priority, according to the company’s Australian business and consumer services manager Dan Metcalf. ...

Two-factor authentication: double or nothing
An extra layer of security keeps hackers at bay.

Resources last updated: 3/19/2016 8:51:27 AM