Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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, 12:54 PM
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. I understand from Imar that
Quote:
Membership.GetUser().ProviderUserKey
could be the answer... How would I use this though?

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?

Regards

Lee

Last edited by leeWozyWarren; December 6th, 2011 at 12:57 PM..
 
Old December 6th, 2011, 02:32 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

To get some ideas on how to implement some of this, take a look at chapter 17, page 641 and further. It show show to keep track of the user name using EF.

I don't know if that helps you though, as I don't know your current data access technology (EF, SqlDataSource, direct SQL and so on).

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

Thanks Imar.

I am putting this to use in a new project to test before I start setting up the real project.

So I have a default page which simple says to log in. from the log in screen it directs you to a profile page where the user can see their log in details and make any amendments. From here they can also create a new client ie a patients Id, Name, Date of birth.... and then for the userID or userName to be filled with the current users Id or name...

I will be using EF I think.

Lee
 
Old December 6th, 2011, 02:56 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Again, it all depends on what you implement and how. Maybe the pages I referred to will help you out if you're using the Data Controls. Alternatively, if you're hand coding pages (as explained in the book as well), this will be a lot easier.

So, I would start by defining a data access strategy and then ask specific follow up questions here.

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

Well ideally I would want to use page coding so that I can use a custom layout that doesn't rely on a gridview or Detailsview...
 
Old December 6th, 2011, 03:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Then build a model in EF, and use the Hand Coding scenario from the book. Adding the user name there is then quite easy,

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
userId to another DB from ASPNETDB...! leeWozyWarren BOOK: Beginning ASP.NET 4 : in C# and VB 2 December 6th, 2011 12:52 PM
Combining aspnetdb.mdf and another DB rsearing ASP.NET 2.0 Basics 1 February 8th, 2007 11:44 AM
aspnetdb.mdf Jackxxx ASP.NET 2.0 Basics 0 January 9th, 2007 01:37 PM
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.