Posts

Showing posts from November, 2017

C# - Convert a PDF File to Base64String

Image
C# Convert a PDF File to Base64String Create a Windows Forms Project Name it “ConvertFileToBase64” Open Form1.cs and add a Label, two textboxes and a button Double click on the button and add the following code: string userPath; userPath = Environment .GetFolderPath( Environment . SpecialFolder .UserProfile) + "\\Desktop" ;         OpenFileDialog ofd = new OpenFileDialog ();         ofd.InitialDirectory = userPath;         ofd.Filter = "html files (*.html)|*.txt|All files (*.*)|*.*" ;         ofd.FilterIndex = 2;         ofd.RestoreDirectory = true ;         ofd.ShowDialog();         string fName = ofd.FileName;         textBox1.Text = ...

Upload a file to a Web server in ASP.NET by using Visual C# .NET

Image
Upload a file to a Web server in ASP.NET by using Visual C# .NET Open the Visual Studio Click New > Project ASP.NET WebApplication Name it accordingly When the Project gets created, right click on it and click on Add > New Item > Web Form Name the form FileUpload.aspx Open the FileUpload.aspx the following code <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="FileUpload.aspx.cs" Inherits ="ASPFileUpload.FileUpload" %> <! DOCTYPE html > < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server">     < title > FileUpload </ title > </ head > < body >     < form id ="form1" enctype ="multipart/form-data" runat ="server">         < p >< input type ="file" id ="File1" name ="File1" runat ="server...