Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 6th, 2011, 09:37 AM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #2 (permalink)  
Old December 6th, 2011, 11:43 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,948
Thanks: 79
Thanked 1,555 Times in 1,532 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
leeWozyWarren (December 6th, 2011)
  #3 (permalink)  
Old December 6th, 2011, 11:52 AM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 10: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



All times are GMT -4. The time now is 07:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.