| Methods in PseudoRequestDictionary |
| .Add(key, value) |
Adds new new key value pair. If an identical key already exists, the new value is stored as the next item. Else a new key will be created.
Keys are not case-sensitive ("MyKey" is identical to "mykey").
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.Add "mykey", "some string"
Response.write oRequest.Form("mykey")
%>
|
| |
| .ReadQuerystring(string) |
Reads a querystring-formatted string into key/value pairs.
The values are expected to be in url-encoded format.
This method is very usefull for re-processing of stored searches.
In fact the PseudoRequestDictionary has first been developed for this purpose.
In this particular application, users could login to a site, and
fill out a large search-form to find information of their interest. They could also
choose to store the search criteria in a database, and give this search a name.
If they did that the Request.Form was stored in the database as a string (something like "a=1&b=hello&c=something+else&a=3").
The ReadQuerystring method of the PseudoRequestDictionary will restore this string into something much similar to the original Request.Form.
|
| |
<%
Dim oRequest, element
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
oRequest.ReadQuerystring Request.Querystring
Response.write oRequest.Form("a")
For each element In oRequest.Form("a").Keys
Response.write element & "<br>"
Next
%>
|
| |
| .ReadRequest() |
Read the formdata submitted to the current page. It supports POST ("multipart/form-data" and "application/x-www-form-urlencoded") and GET.
If the submitted form was used to upload files, then the binary code of the files will be available for further processing, like saving to database or hard disk.
ReadRequest automatically determines if the use of Request.BinaryRead is required.
If Request.BinaryRead has been used then the property BinaryReadDone will have value True.
This is important because after a binaryread, the original Request.Form is unavailable.
|
| |
<%
Dim oRequest, element
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
%>
|
| |
| .Remove(key) |
Removes a key and all its values.
|
| |
<%
Dim oRequest, element
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
For each element In oRequest.Form("a").Keys
Response.write element & "<br>"
Next
oRequest.Remove("a")
For each element In oRequest.Form("a").Keys
Response.write element & "<br>"
Next
%>
|
| |
| .RemoveAll() |
Removes all keys and their values, leaving an empty PseudoRequestDictionary.
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
oRequest.RemoveAll
%>
|
| |
| .ReplaceItem(key, value) |
Replaces the value of a key. The previous data in the key are lost.
If the key did not exist before, a new key is created.
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
Response.write oRequest.Form("a")
oRequest.ReplaceItem "a","4"
Response.write oRequest.Form("a")
%>
|
| |
| .SaveAllFiles(directory) |
Saves all uploaded files to the given directory.
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
oRequest.SaveAllFiles "C:\temp"
%>
|
| |
| |
| Properties in PseudoRequestDictionary |
| .BinaryReadDone |
Boolean. Indicates if a BinaryRead has been done on the Request object.
If the value is False, then the Request.Form is still available.
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
If Not oRequest.BinaryReadDone Then
Response.write Request.Form("a")
End If
%>
|
| |
| .BinaryRequest |
Byte(). The binary value of the complete posted form.
If BinaryReadDone = False, then this has value Null.
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
If oRequest.BinaryReadDone Then
Response.write LenB(oRequest.BinaryRequest)
End If
%>
|
| |
| .Boundary |
String. The boundary (seperator between formfields) after a ReadRequest on "multipart/form-data".
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
If oRequest.BinaryReadDone Then
Response.write oRequest.Boundary
End If
%>
|
| |
| .ContainsFile |
Boolean. Indicates if one or more files have been uploaded
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
If oRequest.ContainsFile Then
oRequest.SaveAllFiles "C:\temp"
End If
%>
|
| |
| .Count |
Integer. Returns the number of keys in the object.
|
| |
<%
Dim oRequest, i, aFieldNames
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
Response.write oRequest.Count
' loop through all fields
aFieldNames = oRequest.Keys
For i = 0 To oRequest.Count -1
Response.write oRequest.Form(aFieldNames(i)) & "<br>"
Next
%>
|
| |
| .Encoding |
String. The encoding type of the submitted form ("multipart/form-data" or "application/x-www-form-urlencoded")
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
Response.write oRequest.Encoding
%>
|
| |
| .Exists(key) |
Boolean. Does the given key exists (case-insensitive).
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
Response.write oRequest.Exists("a")
Response.write oRequest.Exists("b")
Response.write oRequest.Exists("c")
Response.write oRequest.Exists("d")
%>
|
| |
| .Files |
PseudoStringList. Contains all uploaded files
|
| |
<%
Dim oRequest, i, oFile
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
For i = 1 To oRequest.Files.Count
Response.write oRequest.Files.FileNameNumber(i) & " (" & oRequest.Files.FileSizeNumber(i) & ")<br>"
Next
' or, for an identical result
For i = 1 To oRequest.Files.Count
Set oFile = oRequest.Files.ItemNumber(i)
Response.write oFile("filename") & " (" & oFile("filesize") & ")<br>"
Next
%>
|
| |
| .Form(key) |
PseudoStringList. Returns the value of the given key (identical to .Item).
If a key has multiple values, the values are returned as a comma-seperated string just like Request.Form("a").
The .Form property opens up all properties and methods of the PseudoStringList (see below).
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
Response.write oRequest.Form("a")
Response.write oRequest.Form("b")
Response.write oRequest.Form("c")
Response.write oRequest.Form("d")
' for saving a certain file
If oRequest.Form("somefilefield").FileSize > 0 Then
oRequest.Form("somefilefield").SaveAs "c:\temp\myfile.ext"
End If
%>
|
| |
| .Item(key) |
PseudoStringList. Returns the value of the given key (identical to .Form).
|
| |
| .ItemCount(key) |
Integer. The number of values in the given key.
Identical to .Form(key).Count
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
Response.write oRequest.ItemCount("a")
Response.write oRequest.ItemCount("b")
Response.write oRequest.Form("a").Count
%>
|
| |
| .Keys |
Array. Containing all keys present in the object.
|
| |
<%
Dim oRequest, element
Set oRequest = new PseudoRequestDictionary
oRequest.ReadQuerystring "a=1&b=hello&c=something+else&a=3"
For each element In oRequest.Keys
Response.write "oRequest.Form(" & element & ") = " & oRequest.Form(element) & "<br>"
Next
%>
|
| |
| .MultipartFormdataBoundaryBug |
Boolean. Indicates if the fileupload-bug (in IE5 and IE6) has occured.
This bug causes that the Boundary in the posted data is not consistent. The bug occurs
sometimes when a multibyte character (like €) is entered in the form. The
workaround is to use a different HTML characterset:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
Response.write oRequest.MultipartFormdataBoundaryBug
|
| |
| .TotalFormBytes |
Long. The size of the submitted form as read by ReadRequest().
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
Response.write oRequest.TotalFormBytes
%>
|
| |
| .Value |
String. All values and all keys, formatted as a querystring. This the Default value of the object,
which means it is not required to code this property explicitely.
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
oRequest.ReadRequest
Response.write oRequest
' identical to:
Response.write oRequest.Value
%>
|
| |
| .Version |
String. Indicating the version of the Class.
|
| |
<%
Dim oRequest
Set oRequest = new PseudoRequestDictionary
Response.write oRequest.Version
%>
|
| |
| |
| Methods in PseudoStringList |
| .Add(string) |
Adds a new value to the object.
|
| .AddFile(dictionary) |
Adds a new file to the object.
|
| .AddRaw(bytevalue) |
Adds a new file to the object, from data as in a submitted "multipart/form-data" form.
|
| .SaveAs(filepath) |
Saves a file.
|
| .SaveAsNumber(filepath,int) |
Saves a file.
|
| .Destroy() |
Deletes the object
|
| |
| Properties in PseudoStringList |
| .Value |
|
| .Keys |
|
| .Count |
|
| .RawItem(i) |
|
| .ContainsFile |
|
| .Item(i) |
|
| .FileName |
|
| .FileSize |
|
| .ContentType |
|
| .Binary |
|
| .IsFile(i) |
|
| .BinaryNumber(i) |
|
| .ValueNumber(i) |
|
| .FileNameNumber(i) |
|
| .FileSizeNumber(i) |
|
| .ContentTypeNumber(i) |
|
| .ContainsFileNumber(i) |
|