Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2007, 12:56 PM
Authorized User
 
Join Date: Oct 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Roles

Hi,

I use VS 2005, this chapter sample Wrox Blog and MS SQL 2005 of the hosting site.

When I post this page to the hosting site, "ROLE" function doesn't work. When I log in, username and password are working fine. But it doesn't show "Create New Entry" and "Edit This Entry".

If I test it at my local computer with connection to the Hosting Computer's MS SQL 2005 database, it's working fine.


Any advices?

Thanks,


 
Old November 8th, 2007, 07:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

How did you transfer the data to your host? Are you sure you have roles in the remote database which are assigned to your user(s)?

Also, make sure all application configuration sections have applicationName set to the same value, like /.
Search this forum for posts from me with applicationName in their text.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old November 8th, 2007, 01:06 PM
Authorized User
 
Join Date: Oct 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I am very glad to correspond with you - one of the best authors.
I am very much enjoying my ASP.NET programming with your marvelous book.

My steps.

1. In VS 2005
2. Build > Publish Web Site
3. I use Discountasp.net's hosting site. So after I Publish Web Site to this hosting site, I do data file attachement step as Discountasp.net instructed like follows.
4. Then username and password are working fine. But "ROLE" doesn't come there(Edit Ths Entry, Create New Entry doesn't show). It is working fine at my local computer.

Thanks for your kindness.
HD
=================================
Discountasp.net's instruction:

Attach Data File
Use this tool to attach a data file (MDF) to your SQL 2005 database.

1. Upload the MDF file to your website account.
2. Enter the path of the MDF file relative to your website root:

Examples:
\database.mdf
\App_Data\aspnetdb.mdf

WARNING: The current SQL 2005 database will be overwritten.

 
Old November 10th, 2007, 07:30 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This may have to do with the way applications are named in ASP.NET. When ASP.NET creates in application in the aspnet_applications, it may add it as / or as WebSite1 for example, depending on how you connect to your site.

Here's what I would do:

1. Make sure all provider configurations use an applicationName (both in the Membership and Role Manager). Look at chapter 12's web.config file and search this forum for posts from me containing applicationName. Set them all to /

2. Rerun the WSAT tool, create the roles and users.

3. Detach your database and reattach it with your hosts and things should work.

Glad you like the book so much.....

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old November 15th, 2007, 04:58 PM
Authorized User
 
Join Date: Oct 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I didn't solve this problem yet.It does not bring ROLE yet. Username/Password are fine.
Please allow me to ask you a question again based on your advices.
Your kind advice would be really, really appreciated.

Thanks,


1. Make sure all provider configurations use an applicationName (both in the Membership and Role Manager). Look at chapter 12's web.config file and search this forum for posts from me containing applicationName. Set them all to / ===> My definition for Membership and Role in my web.config file is following QUOTE.


2. Rerun the WSAT tool, create the roles and users.===> What's this?

3. Detach your database and reattach it with your hosts and things should work. ===> I believe I do this step exactly same as your advice. I tried to attach .mdf file using VS 2005's Copy Website and WS_FTP95.exe program.


=== QUOTE web.config ===

  <appSettings>
    <add key="DefaultConnectionString" value="SqlServerConnectionString" />
    <add key="EmailFrom" value="[email protected]"/>
    <add key="EmailTo" value="[email protected]"/>
    <add key="FCKeditor:UserFilesPath" value="/Blog/UserFiles"/>
  </appSettings>

  <connectionStrings>
<add name="SqlServerConnectionString" connectionString="Data Source=tcp:sql2k511.discountasp.net;Initial Catalog=SQL2005_420732;User ID=SQL2005_420732_username;Password=mypassword" providerName="System.Data.SqlClient" />
.
.
.

   <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider"
            type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            connectionStringName="SqlServerConnectionString"
            enablePasswordRetrieval="False"
            enablePasswordReset="True"
            requiresQuestionAndAnswer="True"
            applicationName="/"
            requiresUniqueEmail="true"
            passwordFormat="Hashed"
            maxInvalidPasswordAttempts="5"
            passwordAttemptWindow="10"
            passwordStrengthRegularExpression=""
            minRequiredPasswordLength="1"
            minRequiredNonalphanumericCharacters="0"
          />
      </providers>
    </membership>

    <roleManager enabled="true"
                 cacheRolesInCookie="true"
                 cookieName=".ASPROLES"
                 defaultProvider="SqlProvider">
      <providers>
        <add connectionStringName="SqlServerConnectionString" name="SqlProvider"
          type="System.Web.Security.SqlRoleProvider" />
      </providers>
    </roleManager>

 
Old November 15th, 2007, 06:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:1. My definition for Membership and Role in my web.config file is following QUOTE.
You didn't add an applicationName set to "/" to the Role Manager as suggested earlier
Quote:
quote:2. Rerun the WSAT tool, create the roles and users.===> What's this?
Check the second halve of page 270 of the book.
Quote:
quote:3. Detach your database and reattach it with your hosts and things should work. ===> I believe I do this step exactly same as your advice. I tried to attach .mdf file using VS 2005's Copy Website and WS_FTP95.exe program.
Just FTP-ing is probably not enough. That just sends the file to the remote server. You (or your host admin) need to attach the database there.

Maybe this helps a little in understanding the terminology? http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=395

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old November 16th, 2007, 04:52 PM
Authorized User
 
Join Date: Oct 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot Imar!
Finally I have reached the right answer.
My problem was your very first advice "Also, make sure all application configuration sections have applicationName set to the same value, like /. " I added it to the roleManager like follows.

Thanks again for your kind help.
HD

<roleManager enabled="true"
                   cacheRolesInCookie="true"
                   cookieName="TPHROLES"
                   defaultProvider="TPH_RoleProvider">
          <providers>
              <add connectionStringName="SqlServerConnectionString"
                   applicationName="/"
                   name="TPH_RoleProvider"
                   type="System.Web.Security.SqlRoleProvider" /> </providers>
      </roleManager>


 
Old November 16th, 2007, 07:43 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That's why I suggested it first.... ;)

Just kidding; glad it's working now...

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Roles bhasker_braj121 SQL Server 2005 1 January 19th, 2008 12:10 PM
Sitemapnode and roles luca ASP.NET 2.0 Basics 0 September 12th, 2007 11:30 AM
Roles jackandjo BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 October 17th, 2006 03:12 AM
Roles Permissions Many to Many ... Why? seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 2 November 5th, 2004 10:51 AM
Chapter 6 - Roles/Permissions g_rhymes BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 3 June 28th, 2004 11:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.