views:

142

answers:

1

I am trying out Silverlight's Isolated Storage feature. Currently running Silverlight thru ASP.NET page.

I have written some code to request an additional storage but I am not being prompted to add more.

private void requestButton_Click(object sender, RoutedEventArgs e)
{
    using (IsolatedStorageFile store = 
        IsolatedStorageFile.GetUserStoreForApplication())
    {
        if (store.AvailableFreeSpace >= 1000*1024) return;

        long usedSpace = store.Quota - store.AvailableFreeSpace;
        if (store.IncreaseQuotaTo(usedSpace + 1000*1024))
            statusTextBlock.Text = 
                string.Format("Quota has been increased to {0}", store.Quota);
        else
            statusTextBlock.Text = 
                "You have denied quota increase... you Inglorious Basterd...";
    }
}

Silverlight's Application Storage tab doeslist the localhost ASP.NET page hosting Silverlight as shown below.

alt text

According to the screenshot, http://localhost:54389 has 1.0MB of available storage area.
Is there a restriction set on localhost websites that a prompt is ignored?

What are the required steps for Silverlight to prompt users to increase quota?

+1  A: 

Perhaps this might seem a bit simplistic but your screen shot shows that the current space used by localhost:54389 is 0.0MB. Hence the AvailableFreeSpace will be 1.0 MB (the size of the current quota). Now your code has this line in it:-

 if (store.AvailableFreeSpace >= 1000*1024) return;

On that basis I would expect your code return at this point.

AnthonyWJones