E
eschneider
Hello,
I'm trying to use the LoginView control with roles. The roles are in sql server (ASP.NET membership). I can login but the when I go to the page with the LoginView control it can't determine the user role and also creates a access db. Does not seem to be able to connect to the DB, but I'm not sure what I'm doing wrong. Would be nice if it just gave me an error instead of creating a new DB. I'm betting this probably a config issue, seems to be common problem...
Any help would be appreciated.
Thanks,
Eric
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
CodeFile="Downloads.aspx.vb" Inherits="Downloads" %>
<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
Anonymous
</AnonymousTemplate>
<LoggedInTemplate>
Logged in
</LoggedInTemplate>
<RoleGroups>
<asp:RoleGroup Roles="CommercialUse">
<ContentTemplate>
Member of CommercialUse
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="NonCommercialUse">
<ContentTemplate>
Member of NonCommercialUse
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
</asp:Content>
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="MySqlConnection" connectionString="Data Source=SCHNEIDER-LT\SQL2008;Initial Catalog=ssoft;Integrated Security=SSPI;"/>
</connectionStrings>
<system.web>
<authentication mode="Forms" />
<!--<authentication mode="Forms">
<forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"/>
</authentication>-->
<!--<authorization>
<deny users="?"/>
</authorization>-->
<roleManager cacheRolesInCookie="true" cookieName=".MyRolesCookie" enabled="true">
<providers>
<add name="SqlProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="MySqlConnection" applicationName="MyMembership"/>
</providers>
</roleManager>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<!--<clear/>-->
<add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MySqlConnection" applicationName="MyMembership" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed"/>
</providers>
</membership>
<compilation debug="true"/>
</system.web>
</configuration>
I'm trying to use the LoginView control with roles. The roles are in sql server (ASP.NET membership). I can login but the when I go to the page with the LoginView control it can't determine the user role and also creates a access db. Does not seem to be able to connect to the DB, but I'm not sure what I'm doing wrong. Would be nice if it just gave me an error instead of creating a new DB. I'm betting this probably a config issue, seems to be common problem...
Any help would be appreciated.
Thanks,
Eric
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
CodeFile="Downloads.aspx.vb" Inherits="Downloads" %>
<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
Anonymous
</AnonymousTemplate>
<LoggedInTemplate>
Logged in
</LoggedInTemplate>
<RoleGroups>
<asp:RoleGroup Roles="CommercialUse">
<ContentTemplate>
Member of CommercialUse
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="NonCommercialUse">
<ContentTemplate>
Member of NonCommercialUse
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
</asp:Content>
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="MySqlConnection" connectionString="Data Source=SCHNEIDER-LT\SQL2008;Initial Catalog=ssoft;Integrated Security=SSPI;"/>
</connectionStrings>
<system.web>
<authentication mode="Forms" />
<!--<authentication mode="Forms">
<forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"/>
</authentication>-->
<!--<authorization>
<deny users="?"/>
</authorization>-->
<roleManager cacheRolesInCookie="true" cookieName=".MyRolesCookie" enabled="true">
<providers>
<add name="SqlProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="MySqlConnection" applicationName="MyMembership"/>
</providers>
</roleManager>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<!--<clear/>-->
<add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MySqlConnection" applicationName="MyMembership" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed"/>
</providers>
</membership>
<compilation debug="true"/>
</system.web>
</configuration>