none
How to store the Image on BLOB and the URL of the Image in mssql database

    Question

  • I have created an application in asp.net. Here I am allowing  the User to store images. I want to store the Images in a BLOB and want to get the URL of the image and store it in the Ms Sql Database table.

    I have written the Code to get the Container. The only thing that remains now is to add the Images....

    What should I do ahead??? Please help!!!

    Thank you.

    Thursday, April 19, 2012 11:20 AM

Answers

  • First thing I would do is make sure the container's access policy is set to allow public read.
    Wednesday, May 02, 2012 1:29 PM
  • I have a couple simple code samples for upload block blobs that should get that part one.

    That said, make sure the container's access policy has been set to public read (I really should do a quick code sample on setting this programatically) and you can quickly generate the full URI to view the image via a browser. You can get the base URI from the BlobClient then just append the container and blob names with the appropriate slashes between and you're all set.

    • Marked as answer by Shivanand Arur Thursday, April 19, 2012 12:16 PM
    Thursday, April 19, 2012 11:41 AM

All replies

  • I have a couple simple code samples for upload block blobs that should get that part one.

    That said, make sure the container's access policy has been set to public read (I really should do a quick code sample on setting this programatically) and you can quickly generate the full URI to view the image via a browser. You can get the base URI from the BlobClient then just append the container and blob names with the appropriate slashes between and you're all set.

    • Marked as answer by Shivanand Arur Thursday, April 19, 2012 12:16 PM
    Thursday, April 19, 2012 11:41 AM
  • Hello Brent, I am getting an error in the Code "One of the request inputs is out of range." Can you help me to solve this issue.... I read one article where it was written, if we give names to a Container in Uppercase or if there is any Uppercase alphabet in the name, then this exception is thrown.... (This is what I understood).... May be I'm wrong... But I changed the name with all lower case alphabets... But still I'm getting the same error....

    Please Help...

    Thanks!!!

    Friday, April 20, 2012 11:56 AM
  • Sorry for the delay in getting back to your Shivanand, do you have any special characters in the name? What may help is only temporarially use a short and simple name. Anther option is to fire up fiddler or look at using Storage Analytics to further diagnosis exactly why the request is failling.
    Tuesday, May 01, 2012 12:41 PM
  • Hello Brent, I have solved the issue. The Account name in the cscfg file was in Upper case. I simply changed it to lower case and now the app is working fine.

    I have got one more issue, when I dynamically add an image in the BLOB. I am getting the URI, but when I copy the URI and check it in my browser, it gives me an error like this 

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <Error>
    <Code>ResourceNotFound</Code>
    <Message>
    The specified resource does not exist. RequestId:bf2b08cc-54fb-4a24-a045-c008c0164ffe Time:2012-05-02T07:53:56.8774477Z
    </Message>

    </Error>

    I don't know, why this is happening, so please help...

    Wednesday, May 02, 2012 7:55 AM
  • Can you please shre the Format of the URI.

    Thanks,

    Brij

    Wednesday, May 02, 2012 10:07 AM
  • This is the URI

    http://smart*******.blob.core.windows.net/sm***websiteimages/mumbai

    Wednesday, May 02, 2012 10:17 AM
  • First thing I would do is make sure the container's access policy is set to allow public read.
    Wednesday, May 02, 2012 1:29 PM
  • Hey Brent, Thank's a lot, Earlier I had kept the Public Access Type to "OFF" and now I simply changed it to "Blob". I also deleted the old container since I thought the Container might have got corrupt and I re-created it. So now the entire module is working fine....

    Once again, Thank you very much for the help.... :)

    Thursday, May 03, 2012 7:25 AM