I am going to create a website which in that, users can create their own album of pictures and upload them on the website. I am going to use ASP.NET (C#) to develop this website. Each user only has access to the set of images which is dedicated to that user no shared items are permitted, so users should have their own username and password and log in before getting to their album. So I have 2 question, where should pictures get stored 开发者_如何学编程to have prefect access control and restriction. What is the best secure way to authenticate users?
Simply upload that file, and add a record that represents the user's UserId, and the path to the image.
Or you can upload directly to Sql Server 2008's (can you use that) FileStream object to store the images - and still have a record that links it to the user's UserId
To authenticate users just use the MembershipProvider. They will have a user id associated with their login. That becomes your key to look up the images.
You can get their name or user id in different ways. See: How can I access UserId in ASP.NET Membership without using Membership.GetUser()? for more details on getting the Id (via ProviderUserKey)
精彩评论