ASP2ASPX migrates from ASP Request object to ASP.NET Request object (System.Web.HttpRequest).
ASP Request Object | ASP.NET Request Object |
ClientCertificate | ClientCertificate |
Cookies | Cookies |
Form | Form |
QueryString | QueryString |
ServerVariables | ServerVariables |
TotalBytes | TotalBytes |
BinaryRead | BinaryRead |
The changes are related to the Request object and are shown in following table:
API Changes
Method | Change |
Request(item) | In ASP, this property is a Collection. In ASP.NET, Request is a NameValueCollection property that returns a string based on the passed in item key. |
Request.QueryString(item) | In ASP, this property is a Collection. In ASP.NET, QueryString is a NameValueCollection property that returns a string based on the passed in item key. |
Request.Form(item) | In ASP, this property is a Collection. In ASP.NET, Form is a NameValueCollection property that returns a string based on the passed in item key. |
The changes are basically the same for all properties involved.
If the item you are accessing contains exactly one value for the specified key, you do not need to modify your code. However, if there are multiple values for a given key, you need to use a different method to return the collection of values. Also, note that collections in Visual Basic .NET are zero-based, whereas the collections in VBScript are one-based.
For example, in ASP the individual query string values from a request to
http://localhost/myweb/valuetest.asp?values=10&values=20 would be accessed as follows:
|
Following code is generated by ASP2ASPX.
In ASP.NET, the QueryString property is a NameValueCollection
object from which you would need to retrieve the Values collection before
retrieving the actual item you want. Again, note the first item in the
collection is retrieved by using an index of zero rather than one.
|