Webparts for an enitity that is stored in db

Last post 11-13-2009 4:47 AM by cja100. 3 replies.

Sort Posts:

  • Webparts for an enitity that is stored in db

    11-02-2009, 7:11 AM
    • Member
      point Member
    • cja100
    • Member since 11-02-2009, 6:56 AM
    • Posts 3

    I am building a website that hosts multiple little shops advertised on it. each shop needs to use web parts to personalise there own page and the a list of shops, the page is then viewable to non-authenctied users.


    Is it possible to store how the web parts are stored and their custom content (such as a paragraph or 2) in a database?


    (Hope this makes sence)

  • Re: Webparts for an enitity that is stored in db

    11-03-2009, 9:55 PM
    Answer

    Hi,

    Based on my understanding, you want to save the page state into the database. If I have misunderstood you, please feel free to tell me, thanks.

    As I know, if we want to save page state or any page setting modified by users, we can create ASP.NET memebership database first using the ASP.NET Configuration Tool. Then it will save the page state into the ASPNETDB.mdf file by default.

    To customize a database for webparts run the utility named as aspnet_regsql.exe. It is present in the \Windows\Framework\v2.0.50727 subdirectory. This utility helps us to create tables and stored procedures required to customize database. On more thing which we need to do is to customize our web.config file.

    <connectionStrings>
         <clear />
         <add name="LocalSqlServer" connectionString="data source=(local);database=DatabaseName;User Id=UserName;Pwd=Password;"
    </connectionStrings>
    <system.web>
        <compilation debug="true"/>
        <authentication mode="Forms"/>
        <membership>
             <providers>
                   <clear/>
                   <add name="AspNetSqlMembershipProvider"
                           type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                           connectionStringName="LocalSqlServer"
                           applicationName="/CustomConnections" />
             </providers>
        </membership>
        
        <profile enabled="true" defaultProvider="TableProfileProvider">
                 <providers>
                           <clear />
                           <add name="TableProfileProvider"
                                   type="Microsoft.Samples.SqlTableProfileProvider"
                                   connectionStringName="LocalSqlServer"
                                   table="aspnet_Profile"
                                   applicationName="/CustomConnections" />
                 </providers>
        </profile>
    </system.web>


     

    To customize that we need to override these settings in our application's web.config file.

    1, define a connectionString.

    2, "LocalSqlServer" is the name of connection string.

    3,  "ApplicationName" is any name which can mention for identification of our application.

     

    By the way, here are some links below may help you to get more infomation about the issue.

    Walkthrough: Implementing Web Parts Personalization using IPersonalizable

    http://msdn.microsoft.com/en-us/library/ms366720.aspx

    ConnectionString Property

    http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(VS.80).aspx

    Hope it helps.
    I'm always ready for your reply.

    Thank you for thinking of ASP.NET Forums,
    Jerry Weng - MSFT

    If the post helps you, please click the Mark As Answer or the Mark As Not Answer if not.
  • Re: Webparts for an enitity that is stored in db

    11-04-2009, 9:30 AM
    • Member
      point Member
    • cja100
    • Member since 11-02-2009, 6:56 AM
    • Posts 3

    I will look into that thanks.

  • Re: Webparts for an enitity that is stored in db

    11-13-2009, 4:47 AM
    • Member
      point Member
    • cja100
    • Member since 11-02-2009, 6:56 AM
    • Posts 3

    I have looked at that but what I want to do is make a sort of profile page for each user. The user can customise the page using web parts and then their profile page is availableto non-authentcated users. Maybe using a get like this profile.aspx?memberid=345.

Page 1 of 1 (4 items)