Why do I have to log in twice in an Azure deployed LightSwitch application?
-
Sunday, April 29, 2012 7:27 PM
I've published a VS 11 LightSwitch app to Azure. When I navigate tot he site, I receive a "Windows Security" dialog. If I enter the credentials for one of the users in the application, the dialog closes, and then I get the application log in screen.
The Windows Security dialog.The LightSwitch log in screen
Why do I have to enter the credentials twice? I only want users to log in via the LightSwitch log in screen.
Any info is appreciated.
Paul P
PP
All Replies
-
Monday, April 30, 2012 12:01 AM
Are you mixing windows and Forms auth security?
Which one do you want?
I think you only need to turn on Forms auth security inside LightSwitch and turn off Azure security... unless you want windows security. In that case I think you set LightSwitch to use windows security and then it should just let the person in if they are authenticated.
-
Monday, April 30, 2012 1:58 PM
Thanks Michael,
I only want Forms authentication. Where do I turn off Azure security, for this particular app?
Paul
PP
-
Monday, April 30, 2012 11:27 PM
Thanks Michael,
I only want Forms authentication. Where do I turn off Azure security, for this particular app?
Paul
PP
don't know :(
-
Wednesday, July 11, 2012 7:12 AM
Hello,
I have exactly the same problem. Someone knows how to solve it?
Thanks and regards
-
Wednesday, July 11, 2012 2:06 PM
For the life of me I can not remember what I did to resolve this. I may have went as far as to delete the cloud instance, and then recreate it.
The latest version of the application I have deployed is created and deployed using VS 2012 RC. I could very well be that because I went from the beta to RC that may have solved it.
Sorry about that Ramon,
Paul
PP
-
Thursday, July 12, 2012 5:06 AMWhats the web.config look like?
-
Friday, July 13, 2012 12:59 PM
Hello,
I tried several things and I can not figure it out.
I compared the web.config file with another generated a new project and is similar. I have also tried to eliminate deployment through the azure portal to return to be generated when publishing from LightSwitch and continue with the same problem.
If anyone has any ideas I'd appreciate it. Deputy web.config detail for what it is:<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="UserCodeAssemblies" value="Application.Common.dll;Application.Server.dll;" /> <add key="ExtensionAssemblies" value="LS2011ClearBackground.Common.dll;LS2011ClearBackground.Server.dll;Microsoft.LightSwitch.Extensions.Server.dll;RBS.LSExtension.Common.dll;RBS.LSExtension.Server.dll" /> <!-- A value of true will enable diagnostic logging on the server --> <add key="Microsoft.LightSwitch.Trace.Enabled" value="false" /> <!-- A value of true only lets local access to Trace.axd --> <add key="Microsoft.LightSwitch.Trace.LocalOnly" value="true" /> <!-- The valid values for the trace level are: None, Error, Warning, Information, Verbose --> <add key="Microsoft.LightSwitch.Trace.Level" value="Information" /> <!-- A value of true will indicate that logging sensitive information is okay --> <add key="Microsoft.LightSwitch.Trace.Sensitive" value="false" /> <!-- The semi-colon separated list of categories that will be enabled at the specifed trace level --> <add key="Microsoft.LightSwitch.Trace.Categories" value="Microsoft.LightSwitch" /> <!-- A value of true will indicate http requests should be re-directed to https --> <add key="Microsoft.LightSwitch.RequireEncryption" value="false" /> <!-- If no admin user exists, create an admin user with this user name --> <add key="Microsoft.LightSwitch.Admin.UserName" value="" /> <!-- When creating an admin user with Forms auth, use this as the full name --> <add key="Microsoft.LightSwitch.Admin.FullName" value="" /> <!-- When creating an admin user with Forms auth, use this as the pasword --> <add key="Microsoft.LightSwitch.Admin.Password" value="" /> <add key="ApplicationCulture" value="es" /> </appSettings> <connectionStrings> <add name="_IntrinsicData" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|ApplicationDatabasePath|;Integrated Security=True;Connect Timeout=30;MultipleActiveResultSets=True;" /> <add name="80ab3d4a-1f8b-4cca-a574-bee0105802a9" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=SUMO;Integrated Security=True" /> </connectionStrings> <system.web> <!-- LightSwitch trace.axd handler --> <trace enabled="true" localOnly="false" requestLimit="40" writeToDiagnosticsTrace="false" traceMode="SortByTime" mostRecent="true" /> <httpHandlers> <add verb="GET" path="trace.axd" type="Microsoft.LightSwitch.WebHost.Implementation.TraceHandler,Microsoft.LightSwitch.Server.Internal,Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </httpHandlers> <httpModules> <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="LightSwitchModule" type="Microsoft.LightSwitch.WebHost.Implementation.LightSwitchHttpModule,Microsoft.LightSwitch.Server.Internal,Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </httpModules> <compilation debug="false" targetFramework="4.0"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="Microsoft.LightSwitch.Base.Server, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </assemblies> </compilation> <authentication mode="Forms"> <forms name="SUMO" /> </authentication> <pages validateRequest="false"> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </controls> </pages> <!-- Setting maxRequestLength to be much greater than default 4096 so that large data may be uploaded e.g. images, docs --> <httpRuntime maxRequestLength="102400" requestPathInvalidCharacters="" requestValidationMode="2.0" /> <membership defaultProvider="AspNetMembershipProvider"> <providers> <clear /> <add name="AspNetMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="_IntrinsicData" applicationName="SUMO" requiresUniqueEmail="false" requiresQuestionAndAnswer="false" /> </providers> </membership> <roleManager enabled="True" defaultProvider="AspNetRoleProvider"> <providers> <clear /> <add name="AspNetRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="_IntrinsicData" applicationName="SUMO" /> </providers> </roleManager> <profile enabled="True" defaultProvider="AspNetProfileProvider"> <providers> <clear /> <add name="AspNetProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="_IntrinsicData" applicationName="SUMO" /> </providers> <properties> <add name="FullName" /> </properties> </profile> </system.web> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v4.0" /> <providerOption name="WarnAsError" value="false" /> </compiler> </compilers> </system.codedom> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true"> <add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="LightSwitchModule" preCondition="managedHandler" type="Microsoft.LightSwitch.WebHost.Implementation.LightSwitchHttpModule,Microsoft.LightSwitch.Server.Internal,Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </modules> <handlers> <!-- LightSwitch trace.axd handler --> <add name="LightSwitchTrace" path="trace.axd" verb="*" type="Microsoft.LightSwitch.WebHost.Implementation.TraceHandler,Microsoft.LightSwitch.Server.Internal,Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </handlers> <defaultDocument> <files> <clear /> <add value="default.htm" /> </files> </defaultDocument> <security> <requestFiltering allowDoubleEscaping="true" /> </security> </system.webServer> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> <behaviors> <serviceBehaviors> <behavior> <dataContractSerializer maxItemsInObjectGraph="6553600" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <webHttpBinding> <binding maxReceivedMessageSize="6553600" /> </webHttpBinding> </bindings> </system.serviceModel> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.LightSwitch" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="10.0.0.0-99.9.9.9" newVersion="10.0.11.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.LightSwitch.ExportProvider" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="10.0.0.0-99.9.9.9" newVersion="10.0.11.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.LightSwitch.Model.Xaml" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="10.0.0.0-99.9.9.9" newVersion="11.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> <uri> <schemeSettings> <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes" /> <add name="https" genericUriParserOptions="DontUnescapePathDotsAndSlashes" /> </schemeSettings> </uri> </configuration>
-
Saturday, July 14, 2012 3:39 AMI might be parent node IIS config settings that turning on windows auth. Walk up the node tree from the site up and double check windows auth is disabled.
-
Monday, July 16, 2012 11:45 AM
Hi all,
I finally found the solution to the problem. After reviewing over and over all LightSwith configuration files and IIS configuraion, the problem was in my code.
We briefly explain where the problem was: I use the Application class to store some global variables that I use in my application. I also use the method "Application_Initialize" to initialize its values with a code like this:static unidad_medidaItem _unidad_medidaGlobal = null; partial void Application_Initialize() { _unidad_medidaGlobal = Application.Current.CreateDataWorkspace().SUMOData.configuracion_global_SingleOrDefault(1).unidad_medidaItem; }
As you can see what I do is access a table to keep taking a value in a variable.
The problem comes because this method is executed before the LightSwitch forms authentication, and as yet does not have a user to access the data, this causes display the dialog windows style user validation. After running this code already appears in the form authentication that we have configured in the application for access.
If I comment this code, the validation is working properly.
Thanks to all that you have tried to help me and I hope this will help someone too.
regards,- Marked As Answer by Beth MassiMicrosoft Employee, Owner Tuesday, July 17, 2012 9:56 PM
-
Monday, July 16, 2012 8:10 PMThat is great. Thank you for posting back with your fix. That should help others.

