Skip to main content

Currently on a project and need a dll to convert a file from a url location to base64. Apparently i have a dll file that can convert file from a local folder to base64, but cannot use that to convert from url to base64.

 

The file with url looks like this:

 

www.standardfocus.comTestFolderTesttrip25782.pdf

www.standardfocus.comTestFolderTesttrip23482.xlxs

www.standardfocus.comTestFolderTesttrip25782.docx

 

I would love to have all possible idea/solution that can help with this.

 

Regards.

 

Hi Kolade,

 

First convert the URL to Bytes and then bytes to base64.

 

 URl to byte :

 

 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

HttpWebResponse response = (HttpWebResponse)req.GetResponse();
stream = response.GetResponseStream();

using (BinaryReader br = new BinaryReader(stream))
{
int lenth = (int)(response.ContentLength);
buf = br.ReadBytes(lenth);
br.Close();
}

  

byte to Base 64: 

  
_byte=buf;
_sb.Append(Convert.ToBase64String(_byte, 0, _byte.Length));

  let me know if this helps you.

 


Thank you Karan Verma.

 

I would implement and revert back.

 

BR.


Hello Karan,

 

As regards the code outline you gave me on the URI to base64. Apology for the late response.

 

I like to add that, am not a code person. Wanted to know if you could help transform the code into a usable format. Would more than appreciate that.

 

With much respect,

Kolade.


Hi kolade,

 

Find attached dll. There are two methods one return string having  base64 data and other return list with base64 data and file name.


Hi Karan,

 

Many thanks for your help, and for reaching out.

 

Howbeit, after testing the SMO from the dll, here is the result;

 

1. The SMO method 'URLtoBase64WithFileName' only return the FileName.

2. The SMO method 'URLtoBase64' did not return any value.

 

In conclusion, both methods did not return the base64.

 

Thanks for the effort.

 

Regards,


Hi kolade,

Forget to tell about this behaviour pls try to use it in view u will be able to see the result.

Once I will get the time I will look @ this issue why it's not appearing in tester. And send u proper fix..

Hello Karan,

 

Thanks for the help with the dll for converting url to base64. Your solution came in very handy.

 

Am not sure if you have a dll that can also help convert an ADO query to csv file (Comma seprated value).

 

I will be more than grateful if I can have the resource for ADO query to csv file.

 

Many thanks for your support.

 

Best regards,

 

Kolade.


Hi kolade,

 

Check your Inbox.


Reply