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 September 1st, 2009, 02:30 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,

You need to set the minRequiredNonalphanumericCharacters attribute to 0 in the appropriate membership provider in the web.config file:

Code:
 
<membership defaultProvider="SqlProvider">
<providers>
  <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider, 
      System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
minRequiredNonalphanumericCharacters="0"
  connectionStringName="AppointmentBooking" 
  enablePasswordRetrieval="false" 
  enablePasswordReset="true" 
  requiresQuestionAndAnswer="true" 
  applicationName="/" 
  requiresUniqueEmail="false" 
  passwordFormat="Hashed" 
  maxInvalidPasswordAttempts="5" 
  passwordAttemptWindow="10" 
  passwordStrengthRegularExpression=""
/>
</providers>
</membership>
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
supermaitai (October 5th, 2009)
 
Old September 25th, 2009, 12:08 PM
Authorized User
 
Join Date: Jul 2009
Posts: 10
Thanks: 8
Thanked 0 Times in 0 Posts
Default Delete

Hi Imar,

Thanks for all of your help on this. I have another question. I displayed all the appointments on a grid view, then I added a delete fuction to the grid. I created a delete statement "Delete from appointment where id=id" but it deletes ALL of the appointments made. How do i make it so that it will delete just whatever row I choose to delete?

thanks!
Thai
 
Old September 25th, 2009, 05:33 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 Thai,

Take a look at my answer in this thread dated July 17th, 2009. It describes the steps for this operation, and explains which methods to copy / look at to implement this.

DELETE FROM Something WHERE Id = Id

tells the database to delete each record where the Id column matches the Id column. Since the Id is referring to itself, this matches all records and thus you clear the entire table. In your sproc you want to have something like:

CREATE PROCEDURE sprocAppointmentDeleteItem

@id int

AS

DELETE FROM Appointment WHERE Id = @id

Notice the @ here; it's referring to the parameter @id; not to the column Id.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
supermaitai (October 5th, 2009)
 
Old October 5th, 2009, 12:12 PM
Authorized User
 
Join Date: Jul 2009
Posts: 10
Thanks: 8
Thanked 0 Times in 0 Posts
Default Uploading

Thanks for all your help. I have another problem. When I upload it to my server and access it, it gives me an error when I access the page:

"An error occurred while processing the log for database 'C:\DOCUMENTS AND SETTINGS\TM529\DESKTOP\BLAH\SAFE2\APP_DATA\ASPNETD B.MDF'. If possible, restore from backup. If a backup is not available, it might be necessary to rebuild the log.
Could not open new database 'C:\DOCUMENTS AND SETTINGS\TM529\DESKTOP\BLAH\SAFE2\APP_DATA\ASPNETD B.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\Documents and Settings\tm529\Desktop\blah\safe2\App_Data\ASPNETD B.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. "

any suggestions?

thanks
 
Old October 5th, 2009, 12: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

Make sure the account that is used by the web server (often Network Service) has Write permissions to the App_Data folder.

The site seems to be located in your Documents folder which is probably not accessible by the web server account.

Cheers.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
supermaitai (October 5th, 2009)
 
Old October 5th, 2009, 01:08 PM
Authorized User
 
Join Date: Jul 2009
Posts: 10
Thanks: 8
Thanked 0 Times in 0 Posts
Default Error

now it says:

The database 'D:\INETPUB\WWWROOT\ASI\SAFERIDESREG\APP_DATA\ASPN ETDB.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.
Could not open new database 'D:\INETPUB\WWWROOT\ASI\SAFERIDESREG\APP_DATA\ASPN ETDB.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file D:\Inetpub\wwwroot\asi\SafeRidesReg\App_Data\aspne tdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: The database 'D:\INETPUB\WWWROOT\ASI\SAFERIDESREG\APP_DATA\ASPN ETDB.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.
Could not open new database 'D:\INETPUB\WWWROOT\ASI\SAFERIDESREG\APP_DATA\ASPN ETDB.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file D:\Inetpub\wwwroot\asi\SafeRidesReg\App_Data\aspne tdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): The database 'D:\INETPUB\WWWROOT\ASI\SAFERIDESREG\APP_DATA\ASPN ETDB.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.
Could not open new database 'D:\INETPUB\WWWROOT\ASI\SAFERIDESREG\APP_DATA\ASPN ETDB.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file D:\Inetpub\wwwroot\asi\SafeRidesReg\App_Data\aspne tdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.]
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +4846887
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.Com pleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Web.DataAccess.SqlConnectionHolder.Open(Htt pContext context, Boolean revertImpersonate) +87
System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String connectionString, Boolean revertImpersonation) +221
System.Web.Security.SqlMembershipProvider.GetPassw ordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +815
System.Web.Security.SqlMembershipProvider.CheckPas sword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.CheckPas sword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
System.Web.Security.SqlMembershipProvider.Validate User(String username, String password) +78
System.Web.UI.WebControls.Login.AuthenticateUsingM embershipProvider(AuthenticateEventArgs e) +60
System.Web.UI.WebControls.Login.OnAuthenticate(Aut henticateEventArgs e) +119
System.Web.UI.WebControls.Login.AttemptLogin() +115
System.Web.UI.WebControls.Login.OnBubbleEvent(Obje ct source, EventArgs e) +101
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +166
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
 
Old October 5th, 2009, 04: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

Looks like a version conflict to me.

Did you create the database against SQL Server 2008 and now try to open it in 2005? Make sure the versions of the file and server match....

The book ships with 2005 versions of the database.


Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 6th, 2009, 01:22 PM
Authorized User
 
Join Date: Jul 2009
Posts: 10
Thanks: 8
Thanked 0 Times in 0 Posts
Default Booking Logic Error

Quote:
Originally Posted by Imar View Post
Hi there,

It's certainly possible but you'll need to do some programming to get it right.

If you don't have a lot of programming experience you may be able to hack you way around it like this:

1. In HourPicker, in the SelectedHour property, always return 0. This way, all times are record at mid night

2. In the sign up wizard hide the TimePicker control.

3. Hide the Duration control

4. When sign up is about to create the appointment, set Duration to 24 hours.

This way, all bookings are booked for a full day.

Note: this is just an idea; I haven't tested it, or confirmed that this will actually work. Also, I don't know exactly how this effects reports. You'll need to do some investigation and see if this works. I'll be more thah happy to help you with follow up questions that may arise.

Cheers,

Imar
Hi again,

I got this working awhile ago and it works. By default I have all of the days enabled to book. When I go into the management section and I disabled a day, hit update and verified that the date was red out and disabled. But then when I go back into the management section, I reenabled that date and hit update and then go back to verifiy if its bookable, I am able to click "book" but when i finish through the steps toward the last step when I click Finish it says "Sorry, the date and time you selected are not available. You can try again, or find an available time with the availability checker." Then I noticed that it does that for every date on that conference room.

So somehow when I changed the avalible days to book, it breaks the system for that particular conference room.

Any suggestions?

Thanks,
Thai
 
Old October 6th, 2009, 02:05 PM
Authorized User
 
Join Date: Jul 2009
Posts: 10
Thanks: 8
Thanked 0 Times in 0 Posts
Default Help again

I figuered out why it won't allow me to book. Since I hacked it (using your help), to book a full day I trick the system into thinking it is booking from 700 to 859 am which allows it to show only 1 booking slot. ( thats the way I want it to work). But the moment I go into configuration and hit update it changes the time from 700 to 759, therefore it will not allow to book. I had to manually go into the database and change it from 759 to 859. I just have to figure out a way to make it not do this when I hit update.

Any suggestions?
 
Old October 7th, 2009, 01: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

Hi there,

I am not sure I completely understand what you're saying. It's been a while since I wrote the book and this application and you modified some stuff, so you need to provide a bit more detail.

Also, check out the Code Behind of the page you;re talking about, then follow the path into the business layer and data access layer and look into to the stored procedures. Maybe there's an explanation in there somewhere?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Appointment booking system ericma BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 December 23rd, 2008 06:35 AM
Chapter 10: Appointment Booking System shong BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 August 21st, 2008 04:04 AM
Chapter 10: Appointment Booking System shong BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 11 July 21st, 2008 01:38 PM
Modifications in Appointment Booking System newbie07 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 July 18th, 2007 11:49 AM
Appointment Booking System newbie07 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 July 18th, 2007 08:32 AM





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