Silverlight 4 Business Application with authentication

Discussion in 'Silverlight' started by frankpatton, Mar 22, 2011.

  1. Is there anyone out there who is a Silverlight 4 Business Application with authentication hooked in to an DASP SQL2008 database .. I have it working perfectly on my laptop, and is working perfectly in accessing the DASP SQL2008 database. Where I fail is when I try to authenticate .. is there a simple web config example available ? I am willing to share code if anyone would like to look at it
     
  2. This Worked For Me .. Hope It Helps Someone Out There

    <?xml version="1.0"?>
    <configuration>
    <configSections>
    <sectionGroup name="system.serviceModel">
    <section name="domainServices"
    type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection,
    System.ServiceModel.DomainServices.Hosting,
    Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35"
    allowDefinition="MachineToApplication"
    requirePermission="false" />
    </sectionGroup>
    </configSections>

    <system.web>
    <httpModules>
    <add name="DomainServiceModule"
    type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule,
    System.ServiceModel.DomainServices.Hosting,
    Version=4.0.0.0,
    Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
    <compilation debug="true" targetFramework="4.0">
    <assemblies>
    <add assembly="System.Data.Entity, Version=4.0.0.0,
    Culture=neutral,
    PublicKeyToken=b77a5c561934e089" />
    </assemblies>
    </compilation>
    <authentication mode="Forms">
    <forms name=".Bently_ASPXAUTH" />
    </authentication>
    <membership defaultProvider="BTMembershipProvider">
    <providers>
    <clear />
    <add name="BTMembershipProvider"
    connectionStringName="BentlyDatabase"
    applicationName="/Bently"
    type="System.Web.Security.SqlMembershipProvider,
    System.Web, Version=2.0.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a"
    enablePasswordRetrieval="false"
    enablePasswordReset="true"
    requiresQuestionAndAnswer="false"
    requiresUniqueEmail="false"
    passwordFormat="Hashed"
    maxInvalidPasswordAttempts="5"
    minRequiredPasswordLength="4"
    minRequiredNonalphanumericCharacters="0"
    passwordAttemptWindow="10"
    passwordStrengthRegularExpression="" />
    </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="BTRoleProvider">
    <providers>
    <clear />
    <add name="BTRoleProvider"
    connectionStringName="BentlyDatabase"
    applicationName="/Bently"
    type="System.Web.Security.SqlRoleProvider,
    System.Web, Version=2.0.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a" />
    </providers>
    </roleManager>
    <profile defaultProvider="BTProfileProvider">
    <providers>
    <add name="BTProfileProvider"
    connectionStringName="BentlyDatabase"
    applicationName="/Bently"
    type="System.Web.Profile.SqlProfileProvider,
    System.Web,
    Version=2.0.0.0,
    Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a" />
    </providers>
    <properties>
    <add name="FriendlyName" />
    </properties>
    </profile>
    </system.web>
    <system.webServer>
    <security>
    <authentication>
    <basicAuthentication enabled="false" />
    </authentication>
    </security>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
    <add name="DomainServiceModule"
    type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule,
    System.ServiceModel.DomainServices.Hosting,
    Version=4.0.0.0,
    Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    </modules>
    </system.webServer>
    <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
    multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    <connectionStrings>
    <clear/>

    <remove name="LocalSqlServer"/>

    <add name="SQL2008_621130_buickEntities"
    connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
    provider=System.Data.SqlClient;
    provider connection string=&quot;
    Data Source=Sql2k803.discountasp.net;
    Initial Catalog=SQL2008_621130_buick;
    Persist Security Info=True;
    User ID=SQL2008_621130_buick_user;
    Password=ford12345;
    MultipleActiveResultSets=True&quot;"
    providerName="System.Data.EntityClient" />
    <add name="BentlyDatabase"
    connectionString="Data Source=tcp:Sql2k803.discountasp.net;
    Database=SQL2008_621130_buick;
    User ID=SQL2008_621130_buick_user;
    Password=ford12345;
    Integrated Security=false"
    providerName="System.Data.SqlClient" />
    <add name="LocalSqlServer"
    connectionString="Data Source=tcp:Sql2k803.discountasp.net;
    Initial Catalog=SQL2008_621130_buick;
    User ID=SQL2008_621130_buick_user;
    Password=ford12345"
    providerName="System.Data.SqlClient"/>
    </connectionStrings>
    </configuration>
     
  3. frank,
    Thank you for sharing I will have to take a look at this...
     
  4. Frank can you tell us about your application architecture? is it using web services? is it using wcf services?

    I'm no web security guy... i have just spent hundreds of hours trying to get a small SL4 application deployed to IIS7.5 and you really have to be experienced in IIS and security and applicition configuration.

    What is DSAP? I was using windows authentication because my users were in house and this is an intranet application. So i was using a javascript hack to get the windows authenticated user but all of the IIS settings would not always provide access to the user information that way. So a few days ago I moved my windows authentication code to a wcf basic http service. In order or this to work. Still it was hit or miss with the different authentication modes and authorization available. I had my architect who seems to be more knowledgeable then i to help. he took different approach by creating a simple application and seeing what m$ did out of the book. It camed down to changing the configuration files. one for the silverlight application and the web.config file for the asp.net hosting site. One this that stopped me dead in my tracks to begin with was to first create a new SL4 application with an Asp.net web site. so my app was named MyApp and web project was named MyApp.web. The you have to create a silverlight enable web service. So right click on the MyApp.web project and select add item but select the silverlight enabled service option. Also, everyone say the deploy picture is better if you run applicaiton on your development but deploy it to IIS on your dev box before trying to deploy to a hosted site or production server. If you can download fiddler2 and run it as a proxy between your VS2010 and the http message going out over the wire. I could not use this tool because my network people have use locked down tight. I did configure for an logger file to be created and used svr track viewer tool from m$ this helped me solve 3 problems.
     

Share This Page