Asp+ Learning Notes 4

Source: Internet
Author: User
Tags object datetime file system insert version access
asp+| Notes v. asp+ MYWEB application

1). Overview
MyWeb is a new technology in asp+ that allows a asp+ application to run on a machine that does not have a Web server, actually
IE internal operation, can be run offline. Development is no different from server-side application development.
Let the customer be able to install when needed, this is called demand install.
When a user accesses a myweb application, asp+ first tries to find the application locally, and if it is not found, the
Myweb:url Download the application instructions (manifest) and, if successful, download the entire application and install to the local area.
MyWeb is executed in the NGWS run environment (so the client must have the NGWS Runtime Library installed) to access the Independent
Storage System, at the same time, you can establish a connection to the site where the application was originally installed. They cannot access resources on the local machine,
And some of the COM calls (which is somewhat analogous to Java applets).

2). MyWeb Management Tools
If IE55 is installed and the NGWS Runtime environment is installed, you can select the MyWeb button from the browser toolbar.
(The position is at the end of the sidebar, just like the one added after PowerWord), or it can be viewed directly
Input myweb://in the address bar of the device, you can enter the MyWeb management tool.
There are two kinds of myweb applications, one is remote, the other is local.
You can use administrative tools to install a new MyWeb application, or enter MyWeb URL directly from the browser's address bar, and the
Case, if the MyWeb application is already installed, the application will be started directly.

3). Development of MyWeb applications
Similar to the development of a asp+ server application, the final need for a CAB file, with a utility cabarc.exe generated, such as:
Cabarc-p-R n myweb.cab *.aspx *.html *.jpg *.css *.dll *.web
The manifest file is the OSD (Open Software Description) format named Myweb.osd, an example:

<softpkg name= "Demo1" version= "1.0" >
<implementation>
<codebase href=</remoteiconurl>
<Author>white</Author>
<Source> Beijing 123okey. Inc</source>
<size>3000</size>
</softpkg>

4). Slightly
5). Isolated Storage space
MyWeb cannot access the local file system, but can access the isolated storage space provided by GNWS (IsolatedStorage).
Just like accessing a local file, for example:

Reading data
String _storefile= "Mystore";
ArrayList values=new ArrayList ();
IsolatedStorageFileStream stream = null;
try{
stream = new IsolatedStorageFileStream (_storefile,filemode.open);
}catch (Exception e) {}
if (Null!=stream) {
Values= (ArrayList) binaryserializer.deserialize (stream);
Stream. Close ();
}

Save data
IsolatedStorageFileStream stream;
stream = new IsolatedStorageFileStream (_stroefile,filemode.openorcreate);
ArrayList values = new ArrayList ();
Values. ADD ("Test1");
......
Binaryserializer.serializer (Values,stream);
Stream. Close ();

When using the previous example, note that you need to introduce namespaces:
System.IO;
System.IO.IsolatedStorage;
System.Runtime.Serialization.Formatters;

6. Off-line data synchronization
Now this version of MyWeb does not support automatic synchronization.
You can use MyWeb. The Connected property determines whether the current connection is online.


Six, the cache service

Caching dynamically generated content is called output catching.
Caching's special object is called data catching.
A dedicated cache engine is provided in the asp+.

1). Output caching
Sets the expiration/validation of the response, only valid for Get and head, and supports the parameters in the URL exactly the same
Use the content in catching. Content will be stored in cache for 60 minutes by default.
To get an. aspx file to be caching, just add one line:
<%@ OutputCache duration= "%>"
The top 60 means 60 seconds.
To achieve more control, the following:
Response.Cache.SetExpires (DateTime.Now.AddSeconds (60));
Response.Cache.SetCacheability (Httpcacheability.public);
Or:
SetExpires (DateTime.Now.AddSeconds (60));
SetCacheability (Httpcacheability.public);
Setslidingexpiration (TRUE);

2). Data Caching
The cache engine allows you to save the object in which you need to rebuild the cache only after the application restarts. is a dictionary interface, such as:
cache["MyKey"]=myvalue;
MyValue = cache["MyKey"];
if (myvalue!=null)
......

It can also support cleanup, expiration, and so on, as well as file and key values (which can be used for statistical graphics, registers, etc.).
Cases:
Source = (DataView) cache["myDataSet"];
if (Source = null) {
......
Source = new Dateview (ds. Tables[0]);
cache["myDataSet"] = source;
}

File dependencies:
Cache.Insert ("MyData", Source,new cachedependency (Server.MapPath ("Authors.xml"));
Time Expired:
Cache.Insert ("MyData", source,null,datetime.now.addhours

[1] [2] Next page



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.