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 13th, 2008, 06:17 AM
Registered User
 
Join Date: Nov 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Appointment Book Security Database

Imar, I understand the aspnet.mdf database in your application is supposed to keep members, user and role information as well as the application data information such as appointments, etc. While the application works well in my machine using sql-express and the net 2.0 framework, the application does not store the security and role information in your provided database, just the application appointment data gets stored there. Looks like there is a parallel security database that is storing the Administration security information somewhere else. How can I store everything in the same database provided in your package?. Regards, Agustin Fuentes.

 
Old November 13th, 2008, 12:36 PM
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,

Take a look at this blog post: http://weblogs.asp.net/scottgu/archi...25/423703.aspx

The trick is to use the ASPNET_REGSQL tool to prepare your SQL Server database for the providers. Once the database is done, you need to reconfigure the config file so the app knows what database to use.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old November 14th, 2008, 04:35 PM
Registered User
 
Join Date: Nov 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar, thanks for your prompt reply. I followed your suggestion but still the same. Your database captures the new appointment information and the configuration changes to rooms, hours, etc. but none of the user, role or membership information. Those table look empty. But I know the security and application info is somewhere as I can see it via the aspnet web administration interface. I am just puzzled, and perhaps no priority at this time since the application is working wonderfully otherwise. I may get a little deeper on this later and let you know. If you have another tip for me to explore, please let me know. Regards, Agustin Fuentes.

 
Old November 14th, 2008, 04:45 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Maybe I misunderstood what you were asking in the first place?

There's a single database called ASPNETDB.MDF in the Appointment booking application.
It contains both ASP.NET data (aspnet_* tables) and application data (like BookingObject).

New users should end up in the Users and Membership tables, while new appointments should end up in the Appointment table.

What tables are you checking? And how does your web.config file look?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old November 14th, 2008, 05:29 PM
Registered User
 
Join Date: Nov 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, once again thanks. I am checking your aspnetdb.mdf single database tables. The appointment data is populated but not the users and memberships table. They continue empty no matter how many new users and roles I declare in the application. I know the missing information is stored somewhere as I told you in my earlier note.

My web.config looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
  <appSettings>
    <remove key="BookingObjectNameSingular" />
    <add key="BookingObjectNameSingular" value="Conference Room" />
    <remove key="BookingObjectNamePlural" />
    <add key="BookingObjectNamePlural" value="Conference Rooms" />
    <remove key="RequireCommentsInRequest" />
    <add key="RequireCommentsInRequest" value="True" />
    <remove key="FirstAvailableWorkingHour" />
    <add key="FirstAvailableWorkingHour" value="7" />
    <remove key="LastAvailableWorkingHour" />
    <add key="LastAvailableWorkingHour" value="23" />
  </appSettings>

    <connectionStrings>
        <remove name="ReservaUCA" />
        <add connectionString="Server=(local)\Sqlexpress;Databa se=ReservaUCA;Integrated Security=true" name="ReservaUCA" />

  </connectionStrings>
  <system.web>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions
            where data loss can occur.
            Set explicit="true" to force declaration of all variables.
        -->
    <authorization>
      <allow roles="Administrators" />
    </authorization>

    <trace localOnly="false" pageOutput="true" requestLimit="20" />

    <roleManager enabled="true" />

    <pages theme="AppointmentBooking">
      <namespaces>
        <clear />
        <add namespace="System" />
        <add namespace="System.Collections" />
                <add namespace="System.Collections.Specialized" />
                <add namespace="System.Configuration" />
                <add namespace="System.Text" />
                <add namespace="System.Text.RegularExpressions" />
                <add namespace="System.Web" />
                <add namespace="System.Web.Caching" />
                <add namespace="System.Web.SessionState" />
                <add namespace="System.Web.Security" />
                <add namespace="System.Web.Profile" />
                <add namespace="System.Web.UI" />
                <add namespace="System.Web.UI.WebControls" />
                <add namespace="System.Web.UI.WebControls.WebParts" />
                <add namespace="System.Web.UI.HtmlControls" />
            </namespaces>
        </pages>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Forms">
      <forms loginUrl="~/Login.aspx" />
    </authentication>

           <!-- The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.
            -->
        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>

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

      </authorization>
    </system.web>
  </location>

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

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

  <system.net>
    <mailSettings>
      <smtp from="[email protected]">
        <network host="mailhost.ibw.com.ni" password="" userName="" />
      </smtp>
    </mailSettings>
  </system.net>

</configuration>

 
Old November 14th, 2008, 05:52 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I see quite a bit of changes compared to the original app (no need to use remove elements for appSettings keys you create yourself) so it's difficult for me to tell what goes where.

Normally, ASP.NET uses a connection string called LocalSqlServer which points to the App_Data folder of your application where it creates the users. Check out the database in that folder, and I am pretty sure you'll see the users.

The fact that it works with the database that comes with the chapter is because that database is called aspnetdb.mdf which is the default name that ASP.NET expects.

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old November 14th, 2008, 06:09 PM
Registered User
 
Join Date: Nov 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, I know the webconfig file is a little loaded but that maybe do to the fact that I had been played with in the context of iis and the aspnet administration interface utility, but I do not think they are harmful, just make the config file look bulky I guess. When I look at the data folder in the solution explorer I see in the server explorer all the tables you mentioned that comes with your application, but extrangely the security tables are unchanged. The membership table has a record which I guess is the Administrator record you refer to in your book, but nothing else even though I myself once added myself into the role of Administrator. The appointment data is correct in the corresponding tables of the same data base. It is extrange as the security information is not lost since the application uses it rightly for logins etc. Cheers and thanks. Agustin.

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

Take a look at C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONF IG\machine.config and search for LocalSqlServer. Check where the database is looked for.

Alternatively, search your system for files called aspnetdb.mdf with a recent modification date....

And yes, not harmful, but not necessary either....

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old November 14th, 2008, 06:35 PM
Registered User
 
Join Date: Nov 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, there is no LocalSqlServer string in that file. I may have changed it to local and point it to your aspnet database in my e:\ReservasUCA directory where the application resides. I remember doing that because the LocalSqlServer string int the machine.config file causes an error and halted the application. On the other hand I looked for any other aspnet.dbf file in my machine and the one in my application is the only timestamped consistently with the time frame I have been looking this issue, ie today. For your information I am using sqlexpress for this application, even though I have SQL Server Developer installed also, but they seems to coexist peacefully. Regards, Agustin.

 
Old November 14th, 2008, 07:55 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:there is no LocalSqlServer string in that file. I may have changed it to local and point it to your aspnet database in my e:\ReservasUCA directory where the application resides.
That's a pretty bad idea. This file applies to all applications on your server so you should leave that file alone, and change it on an application by application level...

This also makes it pretty difficult to say what's going on; normally, you follow LocalSqlServer or the local web.config file; now it's almost impossible for me to suggest where to look, as it's likely you've changed a lot more.

I would revert it to what it was. Then reconfigure the application's web.config file, and tell it where to look for your database, and for the aspnetdb.mdf database. Only then you'll be able to tell where your users go....

Imar


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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Appointment Booker Database Naming Question richardson167 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 November 21st, 2006 06:40 AM
Database Security jakemertel PHP Databases 10 July 16th, 2006 03:45 PM
Book Title: JAVA Security Stephen Lam BOOK: Access 2003 VBA Programmer's Reference 1 April 6th, 2005 03:54 AM
Security for an Access Database ru1 Access 1 February 9th, 2005 07:24 PM
Access Database security gtmm9 Access ASP 1 November 6th, 2003 11:21 PM





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