asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search





Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Code Samples
Components
Tools
New
Free
Downloads
Vendors
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

When writing web pages, you sometimes want to guarantee that the browser and user that are viewing the page accepts the cookies that you send. Though you can determine, with the Browser object, which browsers accept cookies, some browsers allow the user to refuse cookies even though the browser itself is capable of handling the cookie.

Here is some code that will assign a cookie and then check to make sure that it got assigned. Note that this page is called cookie.asp, changing the name will mean that you have to change the code where it references cookie.asp.


Response.Expires=0

strCookie = Request.Cookies("COOKIE")
strTry = Request.QueryString("Try")


If IsNull(strCookie) OR ( Len(strCookie) = 0) Then

	' Check to see if this is a redirect after the cookie
	' has been set

	If IsNull(strTry) OR (Len(strTry) = 0) Then

		Response.Cookies("COOKIE") = "Set"

		' Redirect to this page and try again.
		Response.Redirect("cookie.asp?Try=Yes")
	Else

		'  User/Browser didn't accept cookies
		'  Do something...
		
		Response.Redirect("bad.asp")

	End If
End If





email this code sample to a colleague

Related Articles
Jan 24, 1997 - Simple ASP Chat
This 15 Seconds' issue contains source code and step by step instructions for creating a chat session using Active Server pages, HTML and a standard web browser. Also demonstrated is writing and reading of a file with an Active Server page.
[Read This Article]  [Top]
Apr 6, 1997 - Creating a List Server with ASP
This issue describes how to make a list server using Active Server, SQL Server, and Stephen Genusa's ASPMail Component. Included are source and instructions for adding the user to the list from a Active Server page, removing the user from the list via a Active Server page, and sending mail to the whole list.
[Read This Article]  [Top]
Apr 22, 1997 - Active Server Components with VS 5.0
A rewrite of part one of a four-part series on Active Server objects. A simple example of creating a Active Server Component in Visual Studio 5.0 using the Active Template Library 2.0. The example component retrieves the user's cookie, if not available issues a new 128-bit cookie. Included in the issue is the source code and step by step instructions. This issue has been rewritten to illustrate the use of Visual Studio 5.0 and ATL 2.0 in writing Active Server Components.
[Read This Article]  [Top]
Apr 22, 1997 - Active Server Components with VS 5.0
A rewrite of part one of a four-part series on Active Server objects. A simple example of creating a Active Server Component in Visual Studio 5.0 using the Active Template Library 2.0. The example component retrieves the user's cookie, if not available issues a new 128-bit cookie. Included in the issue is the source code and step by step instructions. This issue has been rewritten to illustrate the use of Visual Studio 5.0 and ATL 2.0 in writing Active Server Components.
[Read This Article]  [Top]
Jun 23, 1997 - Cookies and The Web: The Goal is Rich Interactivity
Responding to the legitimate concerns of Internet consumers, a diverse group of web developers has voluntarily formed an ad-hoc team and prepared the following article. The accompanying technical paper includes explanations of the underlying technologies, the role of cookies, discussions of the positive and negative ramifications of this technology, and selected references on this and related topics.
[Read This Article]  [Top]
Jul 31, 1997 - Creating a Category Site with ASP
In this issue 15 Seconds implements a catalog site that is build with Active Server pages and SQL Server. Along with the implementation there is source code and a discussion of the advantages and disadvantages of creating a catalog site that gets its content from a database. Included are pages for displaying products, creating a menu page, category page, and running a search across a database.
[Read This Article]  [Top]
Jul 31, 1997 - Creating a Category Site with ASP
In this issue 15 Seconds implements a catalog site that is build with Active Server pages and SQL Server. Along with the implementation there is source code and a discussion of the advantages and disadvantages of creating a catalog site that gets its content from a database. Included are pages for displaying products, creating a menu page, category page, and running a search across a database.
[Read This Article]  [Top]
Sep 11, 1997 - The Last-Modified Header in ASP
A complete discussion of the Last Modified header and the Expires header including the effect they have on Active Server page and various browsers.
[Read This Article]  [Top]
Aug 5, 1999 - Writing ISQL_w in ASP
In this article Christophe Berg show you how to build our own iSql with ASP and ADO 2.0. Using ASP you can build a database administration page that will allow you to modify your database from your browser. It’s both easy to implement and very useful, and it’s a good way to see how to work on a database with ASP.
[Read This Article]  [Top]
Dec 23, 1999 - How to Detect If Cookies Are ON
Mark Burnham offers a quick and easy way to check if your browser accepts cookies. If it does, then you're clear to use session variables when writing ASP scripts. Just follow the sample code to learn how to copy a form and compare SessionIDs.
[Read This Article]  [Top]
Jun 23, 2000 - Centralize Intranet Feedback Using CDONTS
Where the collection of specific feedback is necessary, the mailto attribute just won't cut it. With ASP and CDONTS, Web site owners can obtain specialized information from everyone -- even those without e-mail clients.
[Read This Article]  [Top]
Jul 5, 2000 - Point the Way with Graphics
IImages may also be used via the ASP Request Object. This article will show you how the use the Request.Form("ImageName.X") property for such tasks as record navigation (e.g. << Record 1 of 15 >>) or column headings for HTML tables may use images rather than buttons. type = "SUBMIT") are the common mechanism to allow the user to request actions from your Web site. Images may also be used via the ASP Request Object. This article will show you how the use the Request.Form("ImageName.X") property for such tasks as record navigation (e.g. << Record 1 of 15 > >) or column headings for HTML tables may use images rather than buttons.
[Read This Article]  [Top]
Related Books
Working with Active Server Pages
Understanding ActiveX and OLE: A Guide for Developers and Managers
Professional Active Server Pages
Professional Visual C++ 5.0 ActiveX/COM Control Programming
Teach yourself Active Web Database Programming in 21 Days
Unlocking Active Server Pages
Active Server Pages for Dummies
Active Server Pages How-To : The Definitive Active Server Pages Problem-Solver
Active Server Pages Unleashed
Programming Active Server Pages
Related Knowledge Base Articles
HOWTO: Disabling Cookies Sent by Active Server ...
Q163010 - 1997.06.23
IIS Execution File Text Can Be Viewed in Client
Q164059 - 1997.06.23
INF: How to Access SQL Server Within Active Ser...
Q169377 - 1997.06.23
How To Use Response.Redirect in a Server Script
Q159402 - 1997.06.23
How To Stop Users from Displaying a Frame Outsi...
Q159977 - 1997.06.23


Support the Active Server Industry

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers