예제 #1
0
        protected void Persist_Button_Click(object sender, EventArgs e)
        {
            Guid dataIdentifier = Guid.NewGuid();

            if (FileStorageFacade.FileCountBasedUponFileStorageIndexFile(fileStorageName) > maxAllowed)
            {
                foreach (var guid in FileStorageFacade.GetAllDataIdentifiersBasedUponFileStorageIndexFile(fileStorageName))
                {
                    FileStorageFacade.DeleteDataIdentifier(fileStorageName, guid, DeleteFileBehaviour.ThrowExceptionWhenNotExists);
                }

                InfoLabel.Text = InfoLabel.Text + "Storage was wiped to prevent generating too much traffic";
            }

            try
            {
                FileStorageFacade.StoreHttpRequest(fileStorageName, dataIdentifier, urlToPersist_TextBox.Text, null, AddFileBehaviour.ThrowExceptionWhenAlreadyExists, "NFileStorage");
                RedrawPicturesInFileStorage();
                InfoLabel.Text += string.Format("<br>File {0} was persisted.", dataIdentifier);
            }
            catch (Exception exception)
            {
                InfoLabel.Text = InfoLabel.Text + string.Format("Are you sure the URL was valid?<br><small>Caught exception; {0}</small>", exception.Message);
            }
        }