Category Archives: C# Tutorial

Validating Email in C# using Regex on Server Side


This articles explain you how to validate email in C# using regex. Below is method to validate email: Tweet

Tags: , , , ,

Simple Method to Resize Image in C#


Resizing image is a important part of software development. It enables us to reduce size dynamically while upload an image. Below is method to resize image in C# Asp.net. public void ResizeImage(string sSourceImageFileName, string sDestinationImageFileName, int iWidth, int iHeight) { Size oSize = new Size(iWidth, iHeight); Bitmap oBitmap = new Bitmap((Bitmap)Image.FromFile(sSourceImageFileName), oSize); oBitmap.Save(sDestinationImageFileName, System.Drawing.Imaging.ImageFormat.Png); oBitmap.Dispose(); } Add the above method in a class Imagecl.cs. Below is the usage of above method in ASP.net. Usage ImageUpload.aspx <%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”ImageUpload.aspx.cs” [...]

Tags: , , ,