Pass a param in a URL?

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
I have a site that lets user register then adds them to a db but they are not active.

Then an email is sent to the admin who then goes to an asp.net page and activates the user if he chooses to.

My question is how can I pass the UserID in that email link so that when the admin goes to the generic 'Activate User' page the info for the user at that UserID is brought up?

Basically I want to pass the UID in the email URL link and then grab it when that page is hit later.
 
Well...
http://www.exemple.com/AcceptUser.aspx?UID=4678515

Something like this is possible. You'll have to check in the QueryString object for the Keys "UID" and get his value. The value might be getted from your DB at the moment of your insertion.

Other solution are possible but this one is good.

Another good solution... is to set a periodic task in your SQL-Server that look for all Inactivated user and that send you an email with a link for all of them.

But the better solution that I might think about... is that you search your DB for all inactivated user and that you will be able to select which one are to be activated. But you won't have to bother about the mail since it'll only say to you that a new user is asking for an activation.

Choose whatever please you. :)
 
Sweet. Can you check that link. It doesn't seem to be firing for me.

Thank You.

I thought about the db polling but I think I am going to og with the email.
I pull the UID right after the user gets entered into the system.
 
Haaa haa

That's a good one. I needed a good laugh like that on Friday!!!

I get it now.

One other thing. What code would I use on the other end to pull that string out of the url when the admin hits that page?

Thanks again. I actually tried to correct it to example.com that one didn't work either. Maybe you could get that domain.
 
well ... yeah I could get that domain... :p I'll to buy it somehow :p lolllll

Well for your question... look at :
C#:
Request.QueryString["UID"]
Visual Basic:
[size=2]Request.QueryString("UID")
[/size]

They both return a string. The string match the value after the "=".
If it don't exists however... it'll return null. So make sure to verify that possibility.
After that... only have to activate your user.
 
Back
Top