02/01/2015 by Nitesh

Validate Email Using Regex in C#

Friends, In this small post, I will show you how we can validate a string as proper email or not using Regex class in C#. Below is the code – public bool ValidateEmail(string emailAddress) { string regexPattern = @”^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$”; Match matches=Regex.Match(emailAddress,regexPattern); return matches.Success; } The above function takes a string parameter and returns if the…

Continue Reading »

01/01/2015 by Nitesh

Solution: The server principal is not able to access the database under the current security context in SQL Server

Friends, Yesterday I backed up a SQL database and restored it on a different server. A user was associated with the database on the original server and after I restored it on the new server, the same user was unable to use the database. Trying to use the database gave the error – “The server…

Continue Reading »

31/12/2014 by Nitesh

How To Remove Session Support from SQL Server

Friends, In this post we will see how can we remove Session State Support from SQL Server for ASP.Net applications. To completely remove the Session State support from SQL, we need to perform the following actions – Open Command Prompt Go to C:\Windows\Microsoft.Net\Framework\<Your Framework Version>\ Type aspnet_regsql -S SQLSERVER -U User -P Password -ssremove Confirm the question…

Continue Reading »

30/12/2014 by Nitesh

Generate SQL Script to Manage Session State in Custom SQL Database

Friends, ASP.Net provides 3 different ways to store sessions. They are – InProc Session Mode StateServer Session Mode SQL Server Session Mode In case you are interested to read further about sessions, you can read this excellent article by Abhijit Jana. In this post, we will see some specific details about SQL Server Session Mode….

Continue Reading »

29/12/2014 by Nitesh

How To Check If a File Exists In FTP Server in C#

Friends, In my last post, we saw how can we delete a file from FTP server. However, there might be a situation when you try to delete a file and the file does not exist on the server. In this case, code will throw an error saying “550, File Unavailable“. To solve this, we must…

Continue Reading »

1 9 10 11 12 13 38