View Single Post
  #22 (permalink)  
Old August 3rd, 2012, 09:34 AM
sophia sophia is offline
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Quote:
So, as asked before, please be specific. Tell us if /Member is just a folder or a configured application, shows us the relevant code for the page behind /Member, tells us what you expect to fire and when etc....
Hi Imar, first of all thank you for looking at site.

I uploaded all the files on server as is, Member is a folder containing web.config to restrict unauthorized users.

Root web.config--
Code:
<membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web,             Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="8" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="20" passwordStrengthRegularExpression="" />
      </providers>
    </membership>


<location path="Manage">
    <system.web>
      <authorization>
        <allow roles="Managers" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>

  <location path="Member">
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
  </location>


<connectionStrings>
    <add name="ASPNETDBEntities" connectionString="metadata=res://*/App_Code.ProOnline.csdl|res://*/App_Code.ProOnline.ssdl|res://*/App_Code.ProOnline.msl;provider=System.Data.SqlClient;provider connection string=&quot;workstation id=PropOnline.mssql.somee.com;packet size=4096;user id=******;pwd=******;data source=PropOnline.mssql.somee.com;persist security info=False;initial catalog=PropOnline;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
    <add name="ConnectionString" connectionString="workstation id=PropOnline.mssql.somee.com;packet size=4096;user id=******;pwd=******;data source=PropOnline.mssql.somee.com;persist security info=False;initial catalog=PropOnline" providerName="System.Data.SqlClient" />
  </connectionStrings>

Member/web.config --

Code:
<?xml version="1.0"?>
<configuration>
    <system.web>
      <authorization>
        <allow roles="Managers,Members"/>
        <deny users="?" />
      </authorization>
    </system.web>
</configuration>

Member/Default.aspx.cs --

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using ASPNETDBModel;

public partial class Member_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (ASPNETDBEntities myEntities = new ASPNETDBEntities())
        {

            Guid userId = (Guid)Membership.GetUser().ProviderUserKey;
            var albums = (from a in myEntities.Albums
                         where a.UserId == userId
                         select a).Count().ToString();

            var clients = (from c in myEntities.Clients
                           where c.DealerId == userId
                           select c).Count().ToString();

            lblAlbums.Text = albums;
            lblClients.Text = clients;
        }
    }
}
I hope this is information what you need...
Reply With Quote