TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chevy Mark Sunderland
NA
188
166.7k
system.web.httprequest.cookies cannot be used like a method
Apr 3 2012 2:22 PM
Hi there, I hope your appreciated help.
First of all I must say that I am a newbie when it comes to net language.
This is my problem.
In ASP 3.0 code, this is what I use to set the cookie:
<%@ Language="VBScript"%>
<%
Response.Cookies("MyCookie") = "some value and other characters such as #, $, and so on"
Response.Cookies("MyCookie").Path = "/"
Response.Write(Request.Cookies("MyCookie"))
%>
<body>
<form id="Form1" method="post" action="CookieTest.aspx">
<input type="submit" value="Click Me" ID="Submit1" NAME="Submit1">
</form>
</body>
but I need read this cookie generate with ASP 3.0 code with .NET and use:
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Web.HttpResponse.Cookies" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script runat="server">
public void Page_Load()
{
if (Request.Cookies["MyCookie"].ToString() == "")
{
Response.Write("Hello from CookieTest.aspx ...<br>");
Response.Write(Request.Cookies("MyCookie").Value() + "<br>");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
I get the following error:
system.web.httprequest.cookies cannot be used like a method
Can you help me? thank you in advance.
Your help would be very appreciated
Reply
Answers (
2
)
EnableViewState and ViewStateMode Properties in Asp.Net
Stylesheet in ASP.NET