Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 December 6th, 2011, 10:37 AM
Authorized User
 
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
Default userId to another DB from ASPNETDB...!

I have a set of tables that a doctor uses to keep patient records. For example: client details, therapy notes, etc etc... There are three doctors in the practice.

Here is my question:

I want my logged in users (the doctors) to only be able to access the rows of data that they have created and not rows of data associated with another user. Is this done with Roles or Profiles or Members?

I would assume that the rows of data that the user creates (INSERTS) would have inserted their user ID into a column like UserId, for example.

If so, is this safe enough that other users wont be able to access the wrong rows of data?

And also, how do I get the userId data from the ASPNETDB.mdf to my own database safely?

I have worked through the book, which is my bible, but not really found the answer to this.

Regards

Lee
 
Old December 6th, 2011, 12: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

Hi there,

No, Roles and Profile won't help as you need row based security.

Your thinking is good though in that you need to store the user in the data somehow. You get the id of the user using Membership.GetUser().ProviderUserKey. Alternatively, and recommended by Microsoft, you should use the user name instead along with the application name (set on the provider configuration in web.config).

As long as all your queries take this user id into account, you should be safe.

BTW: for questions not related to the book directly, you're better off posting in a more general asp.net forum category here at wrox.com as you'll attract more viewers.

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:
leeWozyWarren (December 6th, 2011)
 
Old December 6th, 2011, 12:52 PM
Authorized User
 
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
Default

Thank Imar. I'll post it there and see what else pops up. I dont fully understand how to translate your answer into something that I can use, as yet. But thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
about ASPNetDB.mdf bela_sush BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 18th, 2010 10:56 AM
ASPNETDB.mdf Will BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 April 27th, 2009 01:07 PM
Combining aspnetdb.mdf and another DB rsearing ASP.NET 2.0 Basics 1 February 8th, 2007 11:44 AM
ASPNETDB sanindia BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 October 27th, 2006 05:56 PM
Get UserId from ASPNET.db rao965 ASP.NET 2.0 Basics 2 September 27th, 2006 04:18 AM





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