 |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
 | This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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
|
|
|
|

December 11th, 2010, 12:13 PM
|
Authorized User
|
|
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Cannot redirect to ManagePhotoAlbum
Hi,
I've tried the try it out that starts on page 444 and the continue one that starts on`page 452 and I cannot get the NewPhotoAlbum page to redirect to the ManagePhotoAlbum page. I've gone through it step by step twice and still have no joy. I get the following error.
http://i156.photobucket.com/albums/t13/GRiT_02/add.jpg
The Site structure is as follows
http://i156.photobucket.com/albums/t..._02/folder.jpg
Both files seems to be there.
Can you help?
Thanks
Last edited by GeeTee991100; December 11th, 2010 at 12:24 PM..
|

December 11th, 2010, 03:13 PM
|
Authorized User
|
|
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Hi,
I'm still having this problem.
I've even copied the source code from the Chapter 13 folder. Just the two files and I still get the issue. If I load in the whole of chapter 13 it works so I think there must be something I've missed but I've now followed the steps 3 times. Can anyone help?
Thanks
Last edited by GeeTee991100; December 11th, 2010 at 03:17 PM..
|

December 11th, 2010, 04:49 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
My guess is that this is not related to the redirect or structure of your site, but to your LINQ to SQL model. I think myPhotoAlbum is null, and causes the error..
Did you correctly create the database, the relationship between the tables and the L2S model (and in that order)?
Try debugging the Inserted method (debugging is explained in Chappter 17) and then look at e.Exception (e is an argument of the Inserted handler). Does it contain an error message?
Cheers,
Imar
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

December 11th, 2010, 05:55 PM
|
Authorized User
|
|
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Thanks for the response.
By using some old school techniques I worked out the issue was with the database. I get the message "Cannot insert explicit value for identity column in table 'PhotoAlbum' when IDENTITY_INSERT is set to OFF."
Do you know what that means?
Thanks
EDIT: Forgot to mention that I've re-imported the chapter 13 database and still get this issue.
Last edited by GeeTee991100; December 11th, 2010 at 06:02 PM..
|

December 11th, 2010, 07:29 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
That sounds like you make the Id column an identity in the database *after* you created the LINQ to SQL model in Visual Studio. When that happens, L2S doesn't know that Id is an identity generated by the database. This in turn means it will try to supply a value (which is zero in this case - the default for a non nullable Integer) when you try to save the changes. The database then raises an exception because it receives an explicit value for a column that it's supposed to automatically generate.
If this is indeed the problem, the easiest solution to this is to recreate the L2S model; just remove the tables from the model, and drag them onto the design surface again from the Database or Server Explorer. Note, this is about the L2S model / diagram; not about the database diagram.
Hope this helps,
Imar
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

December 11th, 2010, 07:48 PM
|
Authorized User
|
|
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
I deleted all the chapter 13 files re-created the tables and the L2s link and it worked, Thanks for your help.
|

December 12th, 2010, 06:44 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Good to hear it's working. I think only recreating the L2S model would have been enough, but hey, if it works, it works.... ;-)
Cheers,
Imar
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Redirect |
SKhna |
ASP.NET 2.0 Basics |
1 |
February 9th, 2008 08:14 AM |
Redirect within a class |
rolandatem |
General .NET |
3 |
January 23rd, 2006 07:39 AM |
response.redirect |
crmpicco |
Classic ASP Basics |
3 |
February 9th, 2005 01:50 AM |
Redirect To New Page |
Ben Horne |
Flash (all versions) |
2 |
March 26th, 2004 04:24 PM |
|
 |