VERTRIEB: 1-800-867-1380

 none
Is it possible to get Blobs in a case insensitive fashion?

    Frage

  • If I have a bit of code:

    CloudBlob blob = container.GetBlobReference(blobUri);
    

    It appears to be case sensitive, i sort of understand this - but is there a way to get blobs in a case insensitive fashion? I could of course list everything in the container and its sub folders, ToLower() it and find it that way but it sounds terribly inefficient!

    Any ideas appreciated

    Donnerstag, 26. April 2012 18:00

Antworten

  • Hi,

    Try String.ToLowerInvariant()  method or regular expresstion for case-snsitive, or Check this article:

    http://www.dotnetperls.com/tolower-optimization

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    Freitag, 27. April 2012 03:35
  • Blob storage is always case-sensitive. If you need case insensitive access directly from an external URL that points to blob storage, I don't think that's possible at the moment. You might be able to make it work using the CDN, but only if you pull from your web role and not from blob storage.

    If you need cases insensitive access from your app (or if you can have your blob URLs point to your web role), one approach would be to store an index in SQL Azure. You would use the DB to do a case insensitive lookup, mapping the incoming name to the actual blob name.

    You could also create a cache in the local webrole filesystem, either with the entire content of the blobs, or with files that just contain the actual name of the blob. NTFS handles filename lookups in a caseless fashion, so you could use it as a mapping layer.


    Check out my book: Ultra-fast ASP.NET: Building Ultra-Fast and Ultra-Scalable Websites using ASP.NET and SQL Server

    Sonntag, 29. April 2012 01:20

Alle Antworten

  • Nope, blob storage is always case-sensitive. You might want to just lowercase everything before storing it.
    Donnerstag, 26. April 2012 18:08
  • Hi,

    Try String.ToLowerInvariant()  method or regular expresstion for case-snsitive, or Check this article:

    http://www.dotnetperls.com/tolower-optimization

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    Freitag, 27. April 2012 03:35
  • Blob storage is always case-sensitive. If you need case insensitive access directly from an external URL that points to blob storage, I don't think that's possible at the moment. You might be able to make it work using the CDN, but only if you pull from your web role and not from blob storage.

    If you need cases insensitive access from your app (or if you can have your blob URLs point to your web role), one approach would be to store an index in SQL Azure. You would use the DB to do a case insensitive lookup, mapping the incoming name to the actual blob name.

    You could also create a cache in the local webrole filesystem, either with the entire content of the blobs, or with files that just contain the actual name of the blob. NTFS handles filename lookups in a caseless fashion, so you could use it as a mapping layer.


    Check out my book: Ultra-fast ASP.NET: Building Ultra-Fast and Ultra-Scalable Websites using ASP.NET and SQL Server

    Sonntag, 29. April 2012 01:20