473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

What's the proper way of reading cookies? Request.Cookies("mycook") doesnt work

Hi everyone,

May I know the standard way of reading in cookies in ASP.net using
VB.net?

In classic asp, i can do this:

If request.cookies("user") = "abc" then

blah blah

end if

But if i were to do the same in asp.net,

I would hit an ugly error.

What is the proper way of detecting cookies?

Thanks

Mar 31 '07 #1
3 1725
On Mar 31, 10:08 am, "user" <mylinuxjour...@gmail.comwrote:
Hi everyone,

May I know the standard way of reading in cookies in ASP.net using
VB.net?

In classic asp, i can do this:

If request.cookies("user") = "abc" then

blah blah

end if

But if i were to do the same in asp.net,

I would hit an ugly error.

What is the proper way of detecting cookies?

Thanks
Hi........

Here is a quick link.... from asp.net quick start...
http://quickstarts.asp.net/QuickStar...e.aspx#cookies

Thanks...
Masudur
http://www.kaz.com.bd
http://munnacs.blogspot.com

Mar 31 '07 #2
"user" <my************@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
In classic asp, i can do this:

If request.cookies("user") = "abc" then

blah blah

end if

But if i were to do the same in asp.net,

I would hit an ugly error.
Would you...? What ugly error would you hit...?
What is the proper way of detecting cookies?
If Request.Cookies("user") = "abc" Then
' blah blah
End If
Mar 31 '07 #3
user wrote:
Hi everyone,

May I know the standard way of reading in cookies in ASP.net using
VB.net?

In classic asp, i can do this:

If request.cookies("user") = "abc" then

blah blah

end if

But if i were to do the same in asp.net,

I would hit an ugly error.

What is the proper way of detecting cookies?

Thanks
The difference in .NET is that what you get from the Request.Cookies
collection is an HttpCookie object instead of a string. If the cookie
doesn't exist, you get a null reference instead of an empty string.

HttpCookie user = Request.Cookies("user");
if (user != null && user.Value == "abc") {
//blah blah
}

--
Göran Andersson
_____
http://www.guffa.com
Mar 31 '07 #4

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

Similar topics

6
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: ...
3
by: Clouds | last post by:
Hi ! How do I add the dynamic event handler for a dropdownlist present in the itemtemplate of a datalist !! I am doing it in the itemdatabound event of the datalist but it doesnt work... I am...
2
by: thechaosengine | last post by:
Hi eveyone, If anyone could advise on the following I would be truly greatful: I have a fairly standard set up. An IIS 5.1 website set up with anonymous access allowed in all areas of the site...
3
by: Danny | last post by:
i am trying to load different pages and scanning some words out of the pages. But my problem is that the readystate is never 4 except when i show a msgbox example: ...
0
by: Juna | last post by:
I have been working in vs2003, but now started to work in vs2005 but the problem, I have simple web application not website, which work i mean open in browser when we press F5 or run the...
4
by: raaman rai | last post by:
Hi guys, i installed WAMP Server 2 yesterday but i waz surprised to see that the following code doesnt work. Today is <? print strftime("%m/%d/%Y"); ?> The output is just: Today is ...
3
by: jacusp | last post by:
Hi, I have problem with reading cookies. I'd like to save fields of my form into cookies and use them by another page. I save cookies: foreach ($_POST as $idx =$value) { setcookie($idx,...
9
by: AGP | last post by:
I've been scratching my head for weeks to understand why some code doesnt work for me. here is what i have: dim sVal as string = "13.2401516" dim x as double x = sVal debug.writeline ( x)
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.