Server Programming Changes in Alpha Five Version 11
A list of server programming functions, including descriptions of functions and methods that have been removed or deprecated in Alpha Five Version 11.
Several functions and methods (removed in the Alpha Five Version 11 Application Server) and are no longer available in Alpha Anywhere. Any applications which use the following will not run in Alpha Anywhere without being modified.
Do not use property_recurse_assign(), property_to_string(), or property_to_blob() on any of the Application Server objects.
a5w_load_aex() has been removed. See Change In Way AEX Files are Used in a Web Application
a5w_unload_aex() has been removed. See Change In Way AEX Files are Used in a Web Application
a5_count_websessions() has been removed. Use Server.SessionCount as a replacement.
Application.Path() is no longer available. Use Request.ApplicationRoot as a replacement.
Session variables can only be strings. Other variable types are not supported and my not work as expected.
Nothing can be dimmed directly within Request. While Request has always been documented as read-only, this is now strictly enforced and any code that attempts to dim within Request will generate an error.
Request.Variables2 is no longer available. All variables should be accessed using Request.Variables.
Response.Message_Body is now a read-only property. Any attempts to assign any value to it will generate an error.
Response.Add_Cookie(), which was previously marked as deprecated, has been removed. See Replacing Response.Add_Cookie.
Response.Add_Header(), which was previously marked as deprecated, has been removed. See Replacing Response.Add_Header.
Server. variables are no longer available. Code that tries to dim Server.foo as c will run without error, but the behavior will not be as previously expected. It will instead create a local variable Server which will not be visible beyond the current local scope.
Server.ClearA5ICache() has been removed. The A5I cache now automatically monitors the filesystem and does not need to be manually cleared.
Server.ClearGzipCache() has been removed. The Gzip cache now automatically monitors the filesystem and does not need to be manually cleared.
Server.Reset() has been removed, as there are no longer server variables to delete.
ServerSettings.BrowserIdCookieName has been removed.
ServerSettings.BrowserIdLifetime has been removed.
Session.BrowserId has been removed. The Application Server no longer performs automatic browser tracking.
Session.Session_Folder has been removed. Use Session.SaveDataAsFile() to safely store file-based data in the Session instead of attempting to write directly to disk.
<%a5 dim Fn as c = "MySessionPage.html" dim FileData as b FileData = "<html><body><h2>Hello World</h2></body></html>" Session.SaveDataAsFile(Fn,FileData) Response.Redirect( Session.FormatFileDataURL(Fn) ) %>The file extension of the filename used as a key in Session.SaveDataAsFile(Key, data) and Session.FormatFileDataURL(Key) matters, because the extension is used for MIME type parsing. For example, in order to have Excel data treated as such when it is sent to the browser, use an extension of .XLS. The above example uses a file extension of .HTML.
Session.Session_Url has been removed. Use Session.FormatFileDataURL() instead when linking to Session resources.
Session Variables cannot be created directly from a request query string or POST body. This negates the need to use "protected" session variables, as all session variables now effectively "protected". In order to create a session variable, you must execute A5W code to read the request variable and create or set the session variable. A request for a URL such as http://localhost/index.a5w?session.name=John will not create a session variable session.name, but will instead create a request variable which may be accessed as Request.Variables.session.name during the lifetime of that request only.
dim Session.Name as c = Request.Variables.Name
The following will continue to work in the Alpha Five Version 11 Application Server, but will be removed in a future releases. Any applications built or converted to use the current version of Alpha Anywhere should not use any of the items listed below. All new code should be written using the replacement properties and methods specified.
e.rv - Use Request.Variables to directly access request variables (also referred to as "page variables").
e.session - Uses Session to directly access the Session object.
Request.Script_Name - Use Request.ScriptName as a replacement.
Response.Message_Body - Use Response.Write() instead of assigning to Response.Message_Body.
Response.Mime_Type - Use Response.ContentType as a replacement.
Response.Reason_Phrase - Use Response.StatusDescription as a replacement.
Response.Status_Code - Use Response.StatusCode as a replacement. Note that .StatusCode is a numeric variable and .Status_Code is a character variable.
Response.AddCookie() - Use Response.Cookies.Add (System.Web.HttpCookie) or Response.Cookies.Set(System.Web.HttpCookie) as a replacement. See Replacing Response.Add_Cookie
Response.AddHeader() - Use Response.Headers.Add(Name,Value) or Response.Headers.Set(Name,Value) as a replacement. See Replacing Response.Add_Header
Response.Redirect(NewUrl,.t.) - Use Response.RedirectPermanent() to create a permanent redirect instead of the legacy Response.Redirect() syntax. Response.Redirect(Url) is not deprecated, only the syntax specifying the second argument to create a permanent redirect is deprecated.
Session.Reset() - Use Session.Clear() as a replacement.
The following objects, properties, and methods have been added to the V11 Application Server. In some cases they add new functionality, while others supersede a previous property or method.
Request.ScriptName - The requested file, such as "/index.html" (the currently running page). Replaces Request.Script_Name.
Request.GetRequestTempFileName([FileExtension as c]) - Creates a filename for temporary use. Any data stored in the corresponding filename will automatically be removed when the current request completes processing.
The optional FileExtension parameter specifies the extension to use for the temporary file. If omitted, .tmp will be used. FileExtension may be specified with or without the leading dot (e.g. "jpg" and ".jpg" will both work and produce an equivalent result).
Response.ContentType - The MIME type for this Response. Replaces Response.Mime_Type.
Response.Cookies - This is a collection of cookies that will be sent as part of the outgoing response. It is a .NET HttpCookieCollection, with individual items in the collection each being a .NET HttpCookie object. This is identical to ASP.NET's HttpResponse.Cookies and can be used in the same manner. See Replacing Response.Add_Cookie
Response.Headers - This is a collection of headers that will be sent as part of the outgoing response. It is a .NET NameValueCollection, with individual items in the collection each being a simple name-value pair. This is identical to ASP.NET's HttpResponse.Headers and can be used in the same manner. See Replacing Response.Add_Header
Response.OutputStream - A .NET System::IO::Stream object which enables binary output to the outgoing HTTP content body. This is identical to the ASP.NET HttpResponse.OutputStream Property.
Complete documentation of the ASP.NET HttpResponse.OutputStream Property is at http://msdn.microsoft.com/en-us/library/system.web.httpresponse.outputstream.aspx
Response.StatusCode - The HTTP status code for this Response. Replaces Response.Status_Code. Note that .StatusCode is a numeric variable and the legacy .Status_Code is a character variable.
Response.StatusDescription - The HTTP status description for this Response. Replaces Response.Reason_Phrase.
Response.Clear() - Clears all content from the output buffer. It does not clear the headers, see Response.ClearHeaders().
Response.ClearContent() - Clears all content from the output buffer. It does not clear the headers, see Response.ClearHeaders().
Response.ClearHeaders() - Clears all headers from the output buffer. It does not clear the body, see Response.ClearContent().
Response.End() - Signals the Application Server to stop processing the A5W page, returning only the output created so far. Any remaining content in the file will not be processed.
Response.RedirectPermanent() - A new method for creating a permanent redirect. This replaces the Response.Redirect() syntax that specifies the second parameter to create a permanent redirect.
Response.Write() - Write data to the Response body. This is the equivalent of using ?
Session.CallResult - (read-only)
Session.CookieMode - (read-only) A .NET System::Web::HttpCookieMode enumeration that specifies how cookies are used for a Web application.
Complete documentation of HttpCookieMode is at http://msdn.microsoft.com/en-us/library/system.web.httpcookiemode.aspx
Session.Count - (read-only) The number of variables stored in the session.
Session.FormatFileDataURL(Key as C) -
Session.IsCookieless - (read-only) Indicates whether or not cookies are being used to track the state of this session.
Session.Keys - (read-only) A .NET System::Collections::Specialized::NameObjectCollectionBase::KeysCollection collection of the keys for all values stored in session variables.
Complete documentation of System.Collections.Specialized.NameObjectCollectionBase.KeysCollection is at http://msdn.microsoft.com/en-us/library/system.collections.specialized.nameobjectcollectionbase.keyscollection.aspx
Session.Timeout - (read-write) The timeout, in minutes, for this session. A new value must be specified in whole minutes. The minimum timeout is 1 minute and the maximum is 525600 minutes (365 days).
Session.UniqueDataKey - (read-only)
Session.Add(Name as C, Value as A) - Adds a new session variable.
Session.Clear() - Removes all session variables.
Session.GetData(Key as C, BYREF Data as A)
Session.Remove(Name as C) - Removes the specified session variable.
Session.RemoveAll() - Removes all session variables. This is functionally equivelent to Session.Clear().
Session.SaveData(Key as C, Data as A)
Session.SaveDataAsFile(Key as C, Data as B)The file extension of the filename used as a key in Session.SaveDataAsFile(Key, data) and Session.FormatFileDataURL(Key) matters, because the extension is used for MIME type parsing. For example, in order to have Excel data treated as such when it is sent to the browser, use an extension of .XLS after the key/file name.
Response.SendFile() has been extended to allow control over the raising of a Save As prompt in the client. Prior to V11, the Save As dialog would always be opened. To suppress this dialog, specify a logical value of false as the second parameter to the method.
<%a5 'Send a file without explicitly telling the browser to prompt to save. Response.SendFile(Filename,.f.) %>
<%a5 'Send a file, using an alternate name when sent, without explicitly telling the browser to prompt to save. Response.SendFile(Filename,.f.) %>
Session.Abandon() now returns void. Prior to Version 11, it returned a logical result.
Application Server Settings, Session Lifetime is now specified in minutes. Previously the value was specified in seconds.