Wednesday, 31 December 2014
How to download Blobs from Windows Azure
In this Post i would like tto explain about Downloading of Blobs using C# Code.
There are so many ways to download the Blob, am going to Explain Using Shared access signature(SAS).
There are so many ways to download the Blob, am going to Explain Using Shared access signature(SAS).
//Using
Azure Storage
// Retrieve storage account from connection string.
CloudStorageAccount
storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
// Create the blob client.
CloudBlobClient
blobClient = storageAccount.CreateCloudBlobClient();
string containerName =
(sender as LinkButton).CommandArgument;
string fileName = (sender as LinkButton).Text;
//getContainer Name
CloudBlobContainer
container = blobClient.GetContainerReference("myContainer");
CloudBlockBlob
blockBlob = container.GetBlockBlobReference(fileName);
if (blockBlob.Exists())
{
//set the cache control
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(true);
Response.Cache.SetMaxAge(TimeSpan.FromSeconds(300));
Response.Expires = 300;
//set the output content type
Response.ContentType =
blockBlob.Properties.ContentType;
Response.AppendHeader("Content-Disposition", "attachment;
filename="+fileName);
//download the asset to the output stream
blockBlob.DownloadToStream(Response.OutputStream);
}
Monday, 29 December 2014
How to debug Windows Azure WebSite with Visual Studio
Remote debugging is very simple with visual Studio 2013 and we can also debug Window azure websites with Visual Stuio 2012 fot this we need some settings to do.
In this article i will explain about how to debug Using Visual Studio 2013.
for this We need to Install Azure SDK from Version 2.2 onwards Remote Debugging is available for Windows Azure Cloud Service.
We need to Stall Azure SDK 2.2 or latest versions of Azure SDK.
Download Azure SDK
Before Installing SDK, the Server Explorer will be like this
After Installing Now you will New Menu Options.
Remote Debugging :
1. Publish the Website with Configuration mode as debug.
2. Select the Website in Server Explorer and Choose an Option as Attach Debugger.
In this article i will explain about how to debug Using Visual Studio 2013.
for this We need to Install Azure SDK from Version 2.2 onwards Remote Debugging is available for Windows Azure Cloud Service.
We need to Stall Azure SDK 2.2 or latest versions of Azure SDK.
Download Azure SDK
Before Installing SDK, the Server Explorer will be like this
After Installing Now you will New Menu Options.
Remote Debugging :
1. Publish the Website with Configuration mode as debug.
2. Select the Website in Server Explorer and Choose an Option as Attach Debugger.
How to Remove items from the qury string after redirection
Today i will explain about the How to Remove items from the qury string after redirection.
Removing Items from QueryString.
For this we need to add following Using Statements in the Page.
using System.Collections;
using System.Reflection;
Removing Items from QueryString.
For this we need to add following Using Statements in the Page.
using System.Collections;
using System.Reflection;
PropertyInfo isreadonly = typeof(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance
| BindingFlags.NonPublic);
//
Editable
isreadonly.SetValue(this.Request.QueryString, false, null);
//
remove the Item
this.Request.QueryString.Remove("QueryStringParam");
The Process cannot access the file because it is being used by another process.(Exception from HRESULT: 0x80070020)
The Process cannot access the file because it is being used by another process.(Exception from HRESULT: 0x80070020)
This kind of Issue will come with Binding Conflict.There is an another application that is using port number 80.
You can run NETSAT -ano and find out the PID, May be the Process name Skype.exe
This kind of Issue will come with Binding Conflict.There is an another application that is using port number 80.
You can run NETSAT -ano and find out the PID, May be the Process name Skype.exe
Could not load file or assembly 'Newtonsoft.json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
Could not load file or assembly 'Newtonsoft.json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
This kind of Errors will come if Pointing to the Wrong version of dll's.
In Package manager Console Execute: Update-Package -reinstall Newtonsoft.Json.
If you facing an Error after executing the Command, Change the Version of Json in web.config or app.config.
This kind of Errors will come if Pointing to the Wrong version of dll's.
In Package manager Console Execute: Update-Package -reinstall Newtonsoft.Json.
If you facing an Error after executing the Command, Change the Version of Json in web.config or app.config.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I Think you you are pointing to Wrong version, change it 4.5.0.0 to 6.0.0.0
Subscribe to:
Comments (Atom)

