473,698 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.Us erId 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
AccessDataSourc e. 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
ObjectDataSourc e, although I will if that is the only way. It seems like
there should be some way to automatically bind to UserId though.
Nov 18 '05 #1
2 4953
Look at the help file for "Understand ing 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!
*************** ************
"Luke Dalessandro" wrote:
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.Us erId 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
AccessDataSourc e. 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
ObjectDataSourc e, although I will if that is the only way. It seems like
there should be some way to automatically bind to UserId though.

Nov 18 '05 #2
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
OnAcquireReques tState 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

"Cowboy (Gregory A. Beamer) - MVP" <No************ @comcast.netNoS pamM> wrote
in message news:73******** *************** ***********@mic rosoft.com...
Look at the help file for "Understand ing 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!
*************** ************
"Luke Dalessandro" wrote:
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.Us erId 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
AccessDataSourc e. 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
ObjectDataSourc e, although I will if that is the only way. It seems like
there should be some way to automatically bind to UserId though.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2978
by: Tom Szabo | last post by:
Just wandering how can you close a browser remotely. In some web applications the browser closes or refreshes periodically. How is that done and how can it be done through PHP? TIA, Tom
15
16327
by: Reid Nichol | last post by:
Hello, I was wondering if I could control how many bytes are in an int and the byte order. In C/C++ I can use int32 but how do I do this in python? How can I control byte order?
0
1822
by: v I n O | last post by:
hI Geeks Please do let me know how do i find how many instances sql server running on the single machine. or in the n/w my objective should with help of C#/vb.net
4
2027
by: James Salisbury | last post by:
Hi, I was checking my parent's website salisbury.cabrera.net on google by entering villa rent spain cabrera I can see the required site, ranked at 4, but I am concerend by the return at 1 and 5 in the list. Any ideas why somone else may be using the text from my site, and how can I make an abuse report? Thanks
2
2583
by: Frances Del Rio | last post by:
http://www.emol.com/especiales/cocina_chilena/comida.asp this page is so neat (goes in pop-up..) how was this done? how do you give a layer (or div, I guess) a semi-transparency so you can still see img under it? (and how do you do the scroll for the div?) I know HTML very well, I also CSS and JavaScript, but am a bit mystified here... PLEASE respond by e-mail, fdr58@yahoo.com, my access to usenet is very limited.. thank you..
4
1978
by: | last post by:
Developing, building, and testing. How do it the best? Learning from the world leader - Microsoft I'm very interested in how the developing/build/testing workflow @ Microsoft looks like. I think Microsoft as world leader in software developing business must have a very good workflow. Does anyone know how the development flow @ Microsoft looks like?
4
2383
by: Supra | last post by:
in vb6 listbox1.remove item 5 how will i do in vb.net? regards
7
2576
by: anushhprabu | last post by:
#define q(k)main(){ return!puts(#k"\nPRABUq("#k")");} q(#define q(k)main(){return!puts(#k"\nq("#k")");}) guys i'm working on this code.. i got it fromnet.. how this is working.. anyone pls.. it is printing the same content on screen.. how ya.. how it is.. how how how?? please...................
0
1985
by: candra | last post by:
Learn What Hackers Know? -General Hacking Information -Password Security -Scanning, Fingerprinting And Similar Techniques -How Hackers Attack Numerous Internet Services -How Hackers Attack Web Servers, Cgis, PHP, ASP, Etc -How Hackers Attack IRC, Instant Messaging, And Multiplayer Games -Vulnerabilities Found In Platforms With Smaller Market Share -How Hackers Attack Novell And Networks
2
1614
by: belred | last post by:
i just read this blog about how many objects (types) are loaded for a hello world program in C#. http://blogs.msdn.com/abhinaba/archive/2008/09/15/how-many-types-are-loaded-for-hello-world.aspx how can you find out how many are loaded for a python program: print 'hello'
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8610
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7740
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.