The easiest and best way to validate an email address

The easiest and best way to validate an email address

When someone enters an email address, how do we check to make sure it’s legit?  Not legit as in “is it really their email address”, but as in “does it follow the rules to make it a real email address”?

For example, if someone enters “jdshfjsdhf”, that’s not legit.  However, “jskfjsd@jskdjcfs.com” is.  Recently, I ran into a problem where my scheme for validating email addresses was failing me.

Weird HTTP Error 503

Weird HTTP Error 503

503I’m working on an MVC Website.  In development in Visual Studio, things are working perfectly.  My app needs to run in IIS.  Easy enough, right?  Just set it up in IIS and you’re off and running.

Recently though, my IIS instance of the site stopped working.  What?!  I began to get the following error:

HTTP Error 503. The service is unavailable.

Wha wha wha?!  I checked IIS and it’s running properly.  What the heck?  SQL Server is okay.  The thing works perfectly in Visual Studio.  ARG.

Automatically logging users out of a website

Automatically logging users out of a website

codesnippetSession state is a funny thing.  It works really well.  But if users don’t stay active, they’ll lose their session.  That can make for some really strange problems if session isn’t used immediately.  Of course session can be checked for, but that’s a hassle.  It would be easier to simply log users out before their session expires.

Decrypting app.Config

Decrypting app.Config

Do you need to decrypt an app.config file? There are lots of directions explaining the process if you’re dealing with a web application, but if you’re dealing with a windows app or a service of some sort, you don’t have a web.config…  all you have is an app.config. The process isn’t all that different.

Here’s what an encrypted app.config “appSettings” section might look like.

CustomPrincipal and Serialization

CustomPrincipal and Serialization

Recently, I’ve been working on a project that relies on a backend business object layer.  The business object (BO) layer, requires authentication in order to be used.  For most of the systems, this is okay, but my project is to be used by end users.  We don’t need to authenticate the users… we need to authenticate the system.

This is easy enough using the CustomPrincipal object in Rocky Lhotka’s CSLA framework (which is also being used).  We simply create the CustomPrincipal and add that to the ApplicationContext.