HighTechTalks DotNet Forums  

ASP.NET Membership

Dotnet General Discussions microsoft.public.dotnet.general


Discuss ASP.NET Membership in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
Mohamad Elarabi [MCPD]
 
Posts: n/a

Default Re: ASP.NET Membership - 12-29-2007 , 07:10 PM






To index the PhotoUser column run the following SQL command

CREATE INDEX PhotoUserIndex ON Photos (PhotoUser)

The syntax is

Create Index [IndexName] On [TableName] ([ColumnName])

Imho there isn't much wrong with your current approach, and as far as
efficiency this is just fine. There may be benifits to taking advantage of
..Net membership but if you can't implement it you're just wasting your time.
Put it down on your "to learn" list but my advice is to move on with this
project and start a little test project where you can play around with
membership, roles, authorization, personalization, themes, webparts, etc.
These are all very cool and good to know features of the .Net 2.0 framework.

Good luck.

--
Mohamad Elarabi
MCP, MCTS, MCPD.


"Tem" wrote:

Quote:
how would I do that?

"Mohamad Elarabi [MCPD]" <MohamadElarabiMCPD (AT) discussions (DOT) microsoft.com
wrote

Not if you indexed the PhotoUser column.

--
Mohamad Elarabi
MCP, MCTS, MCPD.


"Tem" wrote:

Thanks

If I understand this correctly PhotoUser would store the username of the
user the photo belongs to. Wouldn't this be slow performance wise?
(searching a string)
would it be faster to use UserID uniqueidentifier instead?

"Phil H" <google (AT) philphall (DOT) me.uk> wrote in message
news:aa5c6776-b9e8-4e9e-a8e7-7145a496501e (AT) e6g2000prf (DOT) googlegroups.com...
On 27 Dec, 20:39, "Tem" <tem1... (AT) yahoo (DOT) com> wrote:
Im making a photo gallery application where users can only see their
own
photos.
My photos table looks like this
Id, PhotoName, PhotoURL, PhotoUser

I need to know how I can integrate this with ASP.NET's membership
provider
Can someone points me to the right direction

Thanks

Tem

I'm not sure what you mean by "integrate" but the requirement you
describe could be met by filtering the data table on Membership
username (if that differs from PhotoUser then add an extra column)
which is easily read with the Membership.getuser() function.




Reply With Quote
  #12  
Old   
Phil H
 
Posts: n/a

Default Re: ASP.NET Membership - 12-30-2007 , 07:03 AM






On 29 Dec, 20:44, "Tem" <tem1... (AT) yahoo (DOT) com> wrote:
Quote:
This is what I don't understand
How would it know, who the photo belongs to if there wasn't an identifier
field (PhotoUser) in the Photo table?
I don't know whether I made it clear but I suggested that the
"username" (or user id) that users log in with could be used as a
unique identifier in the photo table. To achieve this a column would
have to be created to contain it, and the identity added to the table
as part of the process of creating user accounts with the Membership
object. It does in effect mean that two databases are being used along-
side each other - the photo database and the membership one but
without a lot of extra coding to create a custom membership provider
it is unavoidable.


Reply With Quote
  #13  
Old   
sloan
 
Posts: n/a

Default Re: ASP.NET Membership - 01-02-2008 , 11:56 AM




I would agree with this approach as well.

If your photos are unique to each user..than sure


Table dbo.Photo
PhotoUUID
UserID ( FK to the membershp...UserID (guid)
PhotoName
--(etc, add others columns if necessary)

that would work.

Then you can write your own usp (user stored procedure) to get a photo list
for a specific UserID


But YOU have to roll this code. Aka, the filtering.

You can use and piggy back off of the UserId (guid) as the uniqueidentifier
for each user...but what I was getting at is that the Membership/Role
providers aren't going to magically do this for you.

create proc dbo.uspPhotoListGetByUserId
( @UserId uniqueidentifier )
as

Select PhotoUUID , UserId, PhotoName, (etc , etc)
From
dbo.Photo ph
where
ph.UserId = @UserId



Go


You'll be able to know the UserId from the membership stuff..but you'll have
to create and call uspPhotoListGetByUserId when needed.






"Phil H" <google (AT) philphall (DOT) me.uk> wrote

Quote:
On 29 Dec, 20:44, "Tem" <tem1... (AT) yahoo (DOT) com> wrote:
This is what I don't understand
How would it know, who the photo belongs to if there wasn't an identifier
field (PhotoUser) in the Photo table?

I don't know whether I made it clear but I suggested that the
"username" (or user id) that users log in with could be used as a
unique identifier in the photo table. To achieve this a column would
have to be created to contain it, and the identity added to the table
as part of the process of creating user accounts with the Membership
object. It does in effect mean that two databases are being used along-
side each other - the photo database and the membership one but
without a lot of extra coding to create a custom membership provider
it is unavoidable.



Reply With Quote
  #14  
Old   
Tem
 
Posts: n/a

Default Re: ASP.NET Membership - 01-02-2008 , 08:31 PM



Is there a way to add this to Membership.GetUser(),
an overload method that gets user by uniqueidentifier GUID instead of by
username

"sloan" <sloan (AT) ipass (DOT) net> wrote

Quote:
I would agree with this approach as well.

If your photos are unique to each user..than sure


Table dbo.Photo
PhotoUUID
UserID ( FK to the membershp...UserID (guid)
PhotoName
--(etc, add others columns if necessary)

that would work.

Then you can write your own usp (user stored procedure) to get a photo
list for a specific UserID


But YOU have to roll this code. Aka, the filtering.

You can use and piggy back off of the UserId (guid) as the
uniqueidentifier for each user...but what I was getting at is that the
Membership/Role providers aren't going to magically do this for you.

create proc dbo.uspPhotoListGetByUserId
( @UserId uniqueidentifier )
as

Select PhotoUUID , UserId, PhotoName, (etc , etc)
From
dbo.Photo ph
where
ph.UserId = @UserId



Go


You'll be able to know the UserId from the membership stuff..but you'll
have to create and call uspPhotoListGetByUserId when needed.






"Phil H" <google (AT) philphall (DOT) me.uk> wrote in message
news:717495e1-8af9-451a-934c-a90963a69d9e (AT) i72g2000hsd (DOT) googlegroups.com...
On 29 Dec, 20:44, "Tem" <tem1... (AT) yahoo (DOT) com> wrote:
This is what I don't understand
How would it know, who the photo belongs to if there wasn't an
identifier
field (PhotoUser) in the Photo table?

I don't know whether I made it clear but I suggested that the
"username" (or user id) that users log in with could be used as a
unique identifier in the photo table. To achieve this a column would
have to be created to contain it, and the identity added to the table
as part of the process of creating user accounts with the Membership
object. It does in effect mean that two databases are being used along-
side each other - the photo database and the membership one but
without a lot of extra coding to create a custom membership provider
it is unavoidable.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.