Changing default date format of your ASP.NET application

by Rohit 1. January 2012 12:14

I messed with this issue for about a month. I recently migrated an old ASP.NET 2.0 application on a private server with Windows 2008 Server R2 Enterprise OS installed. The application consists of few entry forms where date is to be entered in dd/mm/yyyy format. This application has a TextBox to enter the date and not a DateTime picker. Sometimes DateTime picker is not easy to work with when you need to enter old dates often and if you want to keep it null sometimes.

ASP.NET shows error: “Input String was not in a correct format” when date is entered in dd/mm/yyyy format. I re-checked SQL Server documentation, changed SQL Server’s default language for default login (though not recommended), but nothing seemed to solve the problem.

My last workaround with IIS Settings solved the issue.

I am using Windows Server 2008 R2 which comes with IIS 7. Open IIS and right-click the virtual directory of your application.

More...

Tags: , , ,

Technology

About Rohit

I have a tremendous passion for software. My day job at a Fortune 100 company exposes me to all sorts of .NET and SQL Server tasks, but my passion drives me to explore other technologies as well. I recently fall in love with Ruby on Rails and in my spare time trying to explore it. Previously I have worked on PHP as well.

I am one of the technical reviewer of Aptana Studio Beginner's Guide which recently got published through Packt Publishing.

My personal blog is with the name My Days Uncovered
 
You can either use Contact Form or mail me directly at:
 
rohit [at] irohitable [dot] com

Month List