Setting Bucket Name from web.config

Nov 10, 2010 at 9:22 PM
Edited Nov 10, 2010 at 9:24 PM

I have noticed that the Flajaxian Direct Amazon Uploader adapter does not properly set the BucketName attribute if you use the "WebConfig:" prefix, for example:

Control declaration on page:

----

        <fjx:FileUploader ID="FileUploader1"
            runat="server" >
            <Adapters>
                <fjx:DirectAmazonUploader
                    AccessKey="WebConfig:PublicKey"
                    SecretKey="WebConfig:SecretKey"
                    BucketName="WebConfig:BucketName"
                    runat="server"  />
            </Adapters>
        </fjx:FileUploader>

----

Setting value in web.config:

----

<appSettings>
        <add key="BucketName" value="dev-bucket"/>

----

I found that the Flajaxian Proxy Amazon Uploader adapter is able to set the BucketName attribute using WebConfig:BucketName.  I am assuming this is a bug or was not implemented in the Flajaxian Direct Amazon Uploader adapter.  I need to change the bucket name for each environment, therefore it was important that I can parameterize the bucket name value.  As a work around, I set the attribute programatically in the Page_Load event as shown below:  

<script runat="server"> 
    public void Page_Load(object sender, EventArgs args)
    {
        ((DirectAmazonUploader)(FileUploader1).Adapters[0]).BucketName = ConfigurationManager.AppSettings["Bucket"];

    }

</script>

It would be nice to be able to use the WebConfig:BucketName instead though.