Azure Blob’s Ghost Folders?

This week I had to address a upload image to blob application that I had built in my development environment, was working fine, but needed to be configured to work in production.  For the application overall, I used Azure Samples for Upload Image to Storage (built in .NET Core).  In it, the configuration in appsettings.json looks like this:

"AzureStorageConfig": {
    "AccountName": "",
    "AccountKey": "",
    "ImageContainer": "images",
    "ThumbnailContainer": "thumbnails"
}

 

Account Name account name and AccountKey are easily found in Azure Portal, for container I used Azure Storage Explorer just so I could get a full look at the container and its blobs.  The problem was, in my development environment I was uploading DIRECTLY to container.  In the example above, I was uploading to the “images” container.  In my Production environment, though, my ImagesContainer had two folders:  images/small and images/large.  I tried to change the “ImagesContainer”:”images” to “ImagesContainer”:”images/small”, “ImagesContainer”:”images\small” and no go.  Requested URI not found.

Continue Reading

Using Async, Await, Plus a Slight Delay

Today’s problem dealt with how we view our invoices online.  We use an app on the iSeries that creates a PDF and delivers it to a set destination.  That destination, in our case is a regular windows server, the files landing in a small site:   pdf.mycompany.com.

My initial approach was simple, use the PHP API I have sitting on the iSeries to make a call to the program – passing it the parameters for that specific invoice, await response (which gave me the new created filename) and then redirect to that URL.  The method looks something like this:

[HttpGet]
public async Task<ActionResult> GetInvoiceAsync(int invoice)
{
    GetInvoice getInvoice = new GetInvoice();
    var client = new HttpClient();

    string fileName = await getInvoice.LoadPDF(invoice);

    string url = "http://pdf.mycompany.com/";
    url += fileName + ".pdf";

    return Redirect(url);
}

 

This worked great… 90% of the time, but the other 10% of the time, I clicked too quickly on an invoice and got forwarded to a 404.

Continue Reading

.NET Core with PayTrace (Mime Type Fix)

This year I am re-writing my previous payment solution (from PHP to .NET) and first on the project list is credit cards.  We are using PayTrace and their client-side encryption as to not have to worry about PCI Compliance.

I’m to the point where I have a Pre-Payment model with all the fields needed to send via JSON.  I also have a method to request a token for sending (uses demo username and pass) and a test PEM file I downloaded from the PayTrace site.  I also got the webpage scanning credit cards, and I hit submit and.. I get this:

XML Parsing Error: no element found

This is appearing in the console of Inspector in Firefox.  Turns out this a generic error Firefox throws out when it’s expending a file but gets nothing.

My path’s are correct, but the “public_key.pem” file is not attaching to my post.   The problem?  MIME-type.

Continue Reading