|
ASP Application Object
|
ASP.NET Application
Object
|
|
Contents
|
Contents
|
|
StaticObjects
|
StaticObjects
|
|
Contents.Remove
|
Contents.Remove
|
|
Contents.RemoveAll
|
Contents.RemoveAll
|
|
Lock
|
Lock
|
|
Unlock
|
Unlock
|
|
Application_OnEnd
|
Application_OnEnd
(Global.asax)
|
|
Application_OnStart
|
Application_OnStart
(Global.asax)
|
ASP2ASPX migrates from ASP Server object to ASP.NET Server object
(System.Web.HttpServerUtility).
|
ASP Server Object
|
ASP.NET Server Object
|
|
ScriptTimeout
|
ScriptTimeout
|
|
CreateObject
|
CreateObject or New Instance
|
|
Execute
|
Execute
|
|
GetLastError
|
GetLastError
|
|
HTMLEncode
|
HtmlEncode
|
|
MapPath
|
MapPath
|
|
Transfer
|
Transfer
|
|
URLEncode
|
UrlDecode
|
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:
|
<%
'This will output
"10"
Response.Write
Request.QueryString("values")(1)
'This will output
"20"
Response.Write
Request.QueryString("values")(2)
%>
|
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.
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.
|
<%
'This will output
"10"
Response.Write(Request.QueryString.GetValues("values")(1 -
1))
'This will output
"20"
Response.Write(Request.QueryString.GetValues("values")(2 -
1))
%>
|
ASP2ASPX migrates from ASP Response object to ASP.NET Response
object (System.Web.HttpResponse).
|
ASP Response Object
|
ASP.NET Response
Object
|
|
Cookies
|
Cookies
|
|
Buffer
|
Buffer
|
|
CacheControl
|
CacheControl
|
|
Charset
|
Charset
|
|
ContentType
|
ContentType
|
|
Expires
|
Expires
|
|
ExpiresAbsolute
|
ExpiresAbsolute
|
|
IsClientConnected
|
IsClientConnected
|
|
Pics
|
Pics
|
|
Status
|
Status
|
|
AddHeader
|
AddHeader
|
|
AppendToLog
|
AppendToLog
|
|
BinaryWrite
|
BinaryWrite
|
|
Clear
|
Clear
|
|
End
|
End
|
|
Flush
|
Flush
|
|
Redirect
|
Redirect
|
|
Write
|
Write
|
ASP2ASPX migrates from ASP ObjectContext object to ASP.NET
ObjectContext object (System.EnterpriseServices.ContextUtil).
|
ASP ObjectContext
Object
|
ASP.NET ContextUtil
Object
|
|
SetAbort
|
SetAbort
|
|
SetComplete
|
SetComplete
|
|
OnTransactionAbort
|
OnTransactionAbort
|
|
OnTransactionCommit
|
OnTransactionCommit
|
No comments:
Post a Comment