Use the independently stored isolatedstoragesetaskobject to pass values between pages

Source: Internet
Author: User

In Asp.net development, there are many methods for passing values between pages, such as session and cookie. However, in Silverlight, we can implement this through the independent storage object isolatedstoragesettings.

 

(1) first, you need to add the namespace: using system. Io. isolatedstorage on each page that needs to use the passed value;

 

(2) On the login. XAML page, create an isolatedstorage object as follows:

// Use the independently stored isolatedstoragesettings object
Private isolatedstoragesetemediacettings = isolatedstoragesettings. applicationsettings;

 

(3) In the logon button event, add the following session-like statement after the statement that passes verification and jumps to save user information and read the value on other pages.

...

If (! Etettings. Contains ("uname "))
{
Deleetask. add ("uname", this. tbusername. Text. Trim ());
}

...

(4) On the mainpage. XAML page, create an isolatedstoragesettings object and use it to read the stored user information.

...

// Use the independently stored isolatedstoragesettings object
Private isolatedstoragesetemediacettings = isolatedstoragesettings. applicationsettings;

...

If (appsettings. Contains ("uname "))

{

This. tbusername. Text = maid ["uname"]. tostring ();

}

 

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.