ASP.NET 2.0 How-To: Bind datasource parameter to UserID?

L

Luke Dalessandro

I am trying to develop a quick Shopping cart for ASP.NET 2.0. I have added a
CartItems table to the AspNetDB access database, that contaings CartItems
keyed off of the aspney_Users.UserId key (the automatically generated
primary key for the table).

I want to bind the current user's CartItems to a GridView, which should be
really easy. The problem is that I need the UserID as a parameter for my
AccessDataSource. The parameters that can be automatically accessed can come
from any of the:

Control
QueryString
Session
Cookie
Form
Profile

groups.

I can't seem to find UserId exposed anywhere. The profile exposes UserName,
which I use to programatically grab the UserId for logged in users, but the
Cart needs to work for anonymous users...

Any help would be appreciated. I don't really want to write an
ObjectDataSource, although I will if that is the only way. It seems like
there should be some way to automatically bind to UserId though.
 
G

Guest

Look at the help file for "Understanding ASP.NET Profile Properties". You can
add any properties you want. That is where I would start.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
L

Luke Dalessandro

Thanks Cowboy,

This sort-of helps.

I know how to add properties and interact with the Profile object, and to
enable anonymous users.

I also know that I can write Profile values in the Application
OnAcquireRequestState event.

I guess that what I don't know how to do is to access the ASP.NET-assigned
UserID for an anonymous user.

Luke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top