Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6932151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:40:10+00:00 2026-05-27T11:40:10+00:00

I have implemented a VirtualPathProvider to return Theme files (images,css) for an Azure web

  • 0

I have implemented a VirtualPathProvider to return Theme files (images,css) for an Azure web site from the Azure CDN. It is working fine apart from one thing: the files that are coming from the CDN all have their cache control property set to “private” and so are never cached.

The actual blobs have their properties set correctly and if I access one by it’s direct URL (i.e. not through the VPP) then the cache control is correct.

The problem seems to be in the Open() method of the VirtualFile class I have to implement to return the file as a Stream?

public override Stream Open()
    {
        CloudBlobClient client = new CloudBlobClient(cdnURL);
        CloudBlob blob = client.GetBlobReference(blobURL);
        blob.FetchAttributes();
        MemoryStream stream = new MemoryStream();
        BlobRequestOptions options = new BlobRequestOptions();
        options.BlobListingDetails = BlobListingDetails.Metadata;
        blob.DownloadToStream(stream,options);
        stream.Seek(0, SeekOrigin.Begin);
        return stream;
    }

Searching on this and I find most people have the problem the other way – i.e. files are cached when they don’t want them to be. However none of the examples I can find are referencing a file from another URL. They all seem to use databases or just different physical paths.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:40:11+00:00Added an answer on May 27, 2026 at 11:40 am

    Thanks to this answer on the asp.net forum http://forums.asp.net/post/4716700.aspx

    I have resolved the issue by adding in my Open() method:

    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);
    HttpContext.Current.Response.Cache.AppendCacheExtension("max-age=86400");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have implemented a code that fetch single image from 1000+ images. The image
I have implemented a VirtualPathProvider. The VirtualPathProvider reads the view from File system. However
I have implemented VirtualPathProvider class so I can keep all my views in the
Have implemented a site in wordpress with 5 static pages besides the usual blog
I have implemented a custom trace listener (derived from TextWriteTraceListener ) and now I
I have implemented quartz scheduler in my application. And its working upto a certain
I have implemented the database as follows from google.appengine.ext import db from google.appengine.ext import
I have implemented my own VirtualPathProvider for loading 'embedded' views. This works very well
I have implemented web service using rails server. The server uses rails default authentication
We have implemented a feature in our web app that updates the GUI in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.