Link to home
Start Free TrialLog in
Avatar of nikdonovanau
nikdonovanau

asked on

Set Cookie in ASP.NET

Hi Experts

I am trying to set a cookie in ASP.NET

What I want to do is store the Id of the logged in user into a cookie.

What I have is

Response.Cookies("LoggedInUser").Expires = "5/1/2010"
Response.Cookies("LoggedInUser").Value = Request.Form("emailAddress")

And it works fine

But I want to store the Id not the email address. From My stored procedure I get the login information
The Id output is

<%# Get_Login.FieldValue("Id", Container) %>

How do I merge the two?

Cheers
Avatar of cmhunty
cmhunty

What's Get_Login?

You'd just create a method which returns the ID from the stored proc and set Response.Cookies("LoggedInUser").Value to the value it returns.
Avatar of nikdonovanau

ASKER

Yes, Thats exactly what I am after.

What is the correct Syntax to do that.

The Get_Login is the name of my stored procedure.

Sorry if the question seems basic. I am a php devloper and a client of ours needs this proj in vb.net
Its only my second day learning vb.net.

I thought something like
Response.Cookies("LoggedInUser").Value = Get_Login.FieldValue("Id", Container)

But that doesnt do it.
Cheers
ASKER CERTIFIED SOLUTION
Avatar of cmhunty
cmhunty

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks mate.