Loading ...

ASP.NET Blogs | CodeAsp.Net

  • C# Credit Card Validation Class
    Here a quick hitter for you - this little piece of code allows you to validate a credit card (in C#) before submitting for processing. This should work with Visa, Mastercard, Discover, and American Express. I'm not really sure where this came from...or if I even wrote this. I can't remember. But I hope it helps you in your everyday programming.
    Atul Ahuja  · 8/5/2015  · 0  · 2562
    c# americanexpress card credit mastercard snippet validate visa
     /5
    Avg: 0 / 5 (0votes)
  • C# Parse Meta Tags
    You may come across an instance in your C# and ASP.NET programming where you need to download an external webpage and parse the meta tags... specifically, the "Title," "Meta Description," and "Meta Keywords." Here is a method that will show you how to:
    Atul Ahuja  · 8/5/2015  · 0  · 1125
    c# regex parse getmeta meta multiline tags
     /5
    Avg: 0 / 5 (0votes)
  • C# RSS Feed Generator
    C# RSS FEED GENERATOR - This is a snippet of code that you can simply paste into your own code to generate a C# RSS
    Atul Ahuja  · 8/5/2015  · 0  · 941
    c# generator Feed RSS code
     /5
    Avg: 0 / 5 (0votes)
  • If you want to remove invalid chars "* . " / \ [ ] : ; | = ," from file name below is the code which can help you Sample code: using System; using System.IO; using System.Text.RegularExpressions; namespace SampleConsoleApplication { class Program { static void Main(string[] args) { string illegal = "\"A\"\\b/cd/ g**hj:
    Raghav Khunger  · 3/14/2014  · 0  · 5771
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • C#: Swap two integer variables value
    In this blog I will show you how to swap two integer variables. I will be using Interlocked.Exchange to do the same: using System; using System.Threading; namespace SampleConsoleApplication { class Program { static void Main(string[] args) { int i = 1; int j = 2; Console.WriteLine("Before Swapping: i={0}, j={1}", i, j); Interlocked.Exchan
    Raghav Khunger  · 1/17/2014  · 2  · 3155
    c#
     /5
    Avg: 0 / 5 (0votes)
  • In this blog I will show how to replace single backslash with double backslash in a string with REGEX. Let's say we have a string "This is \ test \ string" and we want to replace single backslash with double backslash so that the output comes "This is \\ test \\ string". Below is the sample code to do the same: using System;
    Raghav Khunger  · 1/9/2014  · 0  · 3015
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • In this blog I will show how to replace uppercase letter with "underscore and the letter "in a string with REGEX. Let's say we have a string "ThisIsTestString" and we want to replace uppercase letter with "underscore and the letter" so that the output comes "_This_Is_Test_String". Below is the sample code
    Raghav Khunger  · 1/9/2014  · 0  · 2925
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • In this blog I will show how to validate a string to allow alphanumeric characters only in a string with REGEX. Below is the sample code to do the same: using System; using System.Text.RegularExpressions; namespace SampleConsoleApplication { class Program { static void Main(string[] args) { Regex regex = new Regex("^[a-zA-Z0-9]*$"); //Fir
    Raghav Khunger  · 1/8/2014  · 0  · 2477
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • In this blog I will show how to remove all non numeric characters from a string with REGEX. Let's say we have a string "(912)-555-7777" and remove all non numeric characters so that the string looks like "9125557777". Below is the sample code to do the same: using System; using System.Text.RegularExpressions; namespace Sampl
    Raghav Khunger  · 1/7/2014  · 0  · 2170
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • In this blog I will show how to remove all non alpha numeric characters from a string with REGEX. Let's say we have a string "Hello!@#$123456789~~-_user456welcome" and remove all non alpha numeric characters so that the string looks like "Hello123456789user456welcome". Below is the sample code to do the same: using System; u
    Raghav Khunger  · 1/7/2014  · 0  · 2953
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • In this blog I will show how to reverse all numbers in string with REGEX. Let's say we have a string "Hello 123456789 user 456 welcome." and we want to reverse it like "Hello 987654321 user 654 welcome.". Below is the sample code to do the same: using System; using System.Linq; using System.Text.RegularExpressions; namespace
    Raghav Khunger  · 1/6/2014  · 0  · 2047
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • I encountered a piece of code where regex replacement was done in the following way: Regex.Replace(@"\d+", m => new string(m.Value.Reverse().ToArray())); It was giving the following error: Can not access non-static method Replace in static context The issue with the above code was that the inputstring parameter was missing. The osl
    Raghav Khunger  · 1/6/2014  · 0  · 2407
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • While using Directory.GetFiles I started getting the following excpetion Path too long error message when exceeding MAX_PATH Luckily I came across the following library: Delimon.Win32.I​O Library (V4.0) http://gallery.technet.microsoft.com/DelimonWin32IO-Library-V40-7ff6b16c This Library is written specifically to overcome the limitation of the .NE
    Raghav Khunger  · 12/27/2013  · 0  · 1447
    c#
     /5
    Avg: 0 / 5 (0votes)
  • File.Move: Access to the path is denied
    While using the File.Move method to move a file from one location to other: File.Move(oldPath, newPath); I was getting the following exception: Access to the path is denied. Exception Details: System.UnauthorizedAccessException: Access to the path is denied. The fix for this was to give IIS_USRS account full control permissions: After giving the pe
    Raghav Khunger  · 12/27/2013  · 0  · 2974
    asp.net c# file-move
     /5
    Avg: 0 / 5 (0votes)
  • This is an off-topic post. I had to blog about it because Activision deserves to be slammed for not providing the pause option when playing "extinction" or "squad" offline.
    Vivek Thakur  · 11/16/2013  · 0  · 2708
    asp.net c#
     /5
    Avg: 0 / 5 (0votes)
  • Below is the code which can help you to copy all the folders and files of a directory to a backup folder inside it. Let's create a helper class to do the same: #region Using Directives using System; using System.Collections.Generic; using System.IO; using System.Linq; #endregion public static class FileHelper { public static void BackupDirector
    Raghav Khunger  · 10/30/2013  · 0  · 5026
    c# directory-info
     /5
    Avg: 0 / 5 (0votes)
  • I was working with a program noticed where I needed to use curly itself inside a string and string.format was not wroking with it. I was having the following sting: string myString = string.Format("This is test {0} {", "string"); The reason for this not working was that "{" is special character which string.format uses
    Raghav Khunger  · 6/28/2013  · 0  · 1559
    c# string.format
     /5
    Avg: 0 / 5 (0votes)
  • Avoid windows authentication login prompt in IE
    If you are using Windows Authentication and want to avoid the login prompt which comes when you try to access the application this blog will help you. The solution I am writing below is only for IE. In order to avoid that and let IE use the same credentials by which you are logged in into the Windows. Go to Tools -> Internet Option ->
    Raghav Khunger  · 4/19/2013  · 0  · 2420
    asp.net c# iis7 windows-authentication
     /5
    Avg: 0 / 5 (0votes)
  • Lets say we have two classes Person1 and Person2. Below is the code for it: public class Person1 { public int ID { get; set; } public string Name { get; set; } public string FirstName { get; set; } public string Age { get; set; } } public class Person2 { public string Name { get; set; } public string FirstName { get; set; } } Our goal is to find ou
    Raghav Khunger  · 4/15/2013  · 0  · 1524
    .net c#
     /5
    Avg: 0 / 5 (0votes)
  • While parsing one of my regex pattern based on input data I was getting the following error: RegEx: Quantifier {x,y} following nothing error I was having the following code: string pattern = string.Format(@"\b({0})\b", string.Join("|", dic.Select(p => p.Key).ToArray())); Regex reg = new Regex(pattern, RegexOptions.IgnoreC
    Raghav Khunger  · 4/11/2013  · 0  · 4629
    c# regex
     /5
    Avg: 0 / 5 (0votes)
  • While working with transmitting files via server side was not working when filename was having space
    Raghav Khunger  · 2/18/2013  · 0  · 3549
    asp.net c#
     /5
    Avg: 0 / 5 (0votes)
  • In order to get mimetype/contenttype from file name/extension you need to make use of "System.Web.Mi
    Raghav Khunger  · 11/4/2012  · 0  · 7591
    .net c# .net-4 content-type mime-type
    3.83 
     /5
    Avg: 3.83 / 5 (1votes)
  • The reason of this issue is that on 64 bit process uses WOW64 folder. You need to write the code whi
    Raghav Khunger  · 11/2/2012  · 0  · 9145
    c# registry
     /5
    Avg: 0 / 5 (0votes)
  • I will show you how to get connecting string stored in registry. The code which I will show in this
    Raghav Khunger  · 11/2/2012  · 0  · 6388
    c# registry
     /5
    Avg: 0 / 5 (0votes)
  • Considering all subdirectories: string directoryPhysicalPath="xxxx"; string[] files = Directory.GetF
    Raghav Khunger  · 10/13/2012  · 0  · 2972
    c# files
     /5
    Avg: 0 / 5 (0votes)
  • Page 1 of 4 (86 items)
  • « Previous 
  • 1
  • 2
  • 3
  • 4
  • Next »
  •   Go to page:  Go
Clear filter

Filter blogs

Top Producers

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?