Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · ASP.NET Newsletter Application · Web Hosting Plans · Faisal Khan's Blog · Contact
Search Stardeveloper.com
Newsletter
Enter your email address to receive full length articles at Stardeveloper:


Article Categories
.NET  .NET
  ASP (16)
  ASP.NET (43)
  ADO (16)
  ADO.NET (11)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)

Main Category  Other
  Website Maintenance (3)
Log In
UserName Or Email:

Password:

Auto-Login:

Hosted by Securewebs.com
 
Home : .NET : ASP : Extremely useful ASP functions
 
Read full length articles at Stardeveloper using Twitter Follow on Twitter Facebook Facebook fan page Email Get Articles via Email RSS Get Articles via RSS Feed

Function No.4
This fourth function will get variables from forms and/or querystrings, and write them to the client as a cookie. This is often a method used for storing variables (Not my preference) Online applications that store lots of cookies will benefit from this function.

Usage:- Call Writecookies(StrType, IGNORELIST) Where 'StrType' is a string value of either, "form", "querystring", or "all" and 'IGNORELIST' is a comma seperated string of field names to ignore. (Case INsensitive)

EXAMPLE:- To write a cookie of all values submitted to the page via a form.

<% Call WriteCookies("Form","") %>

ALL COOKIES WILL EXPIRE AFTER 60 DAYS, You may change this setting below. If you wanted to exclude a field for whatever reason, then follow the example as for the 'IncludeHidden' function.

<%
Function WriteCookies(StrType, IGNORELIST)
If lcase(StrType) = "form" or lcase(StrType) = "all" then
For each Field in Request.Form
If NOT Onlist(Field, IGNORELIST) Then
Response.Cookies(Field)=Request.Form(Field)
Response.Cookies(Field).Expires = now() + 60 
'Set the cookie to expire 60 days from now
End If
Next
End if

If lcase(StrType) = "querystring" or lcase(StrType) = "all" then
For each Field in Request.QueryString
If NOT Onlist(Field, IGNORELIST) Then
Response.Cookies(Field)=Request.QueryString(Field)
Response.Cookies(Field).Expires = now() + 60 
'Set the cookie to expire 60 days from now
End If
Next
End if
END Function
%>

Function No.5
This function is needed by the other functions, and must also be included in any files which use the IncludeHidden, WriteQuerystring and WiteCookies Functions.

Function Onlist(StrField,StrIgnoreList)
TheArray=Split(StrIgnorelist,",")
If isarray(TheArray) Then
For count=LBound(TheArray) to UBound(TheArray)
If lcase(StrField) = lcase(TheArray(Count)) Then
Onlist=True
End If
Next
End If
End Function

Previous ( 1 Gone )( No Further Pages )

Related Articles
  1. Server Side Email Addresses Validation using VBScript
  2. How to send emails using Classic ASP?
  3. Basic Active Server Pages Tutorial for beginners
  4. Uploading Files to the Server Hard Disk using plain ASP
  5. Object Oriented Design Principles in Visual Basic
  6. Beginning E-Commerce : Object Oriented Programming
  7. Professional Windows DNA
  8. Create your own Newsletter in ASP 3.0
  9. An ASP Tutorial to create your own Database driven Search Engine
  10. Connections, Commands and Procedures

Comments/Questions ( Threads: 9, Comments: 16 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

  1. calling function
  2. Need help
  3. Insert Record into access database without submit button
  4. need solution for uploading problem ( 2 Replies )
  5. Populate combo boxes (country and state) by using values from the database ( 2 Replies )
  6. Connecting to SQL Server 2000 Database in ASP ( 1 Reply )
  7. Save multiple files/images into database ( 1 Reply ) This thread contains 1 reply by Faisal Khan.
  8. Support required . ODBC Error found when upload my asp pages ( 1 Reply ) This thread contains 1 reply by Faisal Khan.
  9. Using Multiple CheckBox Updation in Oracle Database

Post Comments/Questions

In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed.

 
© 1999 - 2010 Stardeveloper.com, All Rights Reserved.