Restore failed for Server ./SQLEXPRESS

A wise man once told me: “The quatilty of your life is directly proportional to the quality of your backups”. I have come to respect this advice greatly. A few weeks ago my dedicated server went down. The incompitent tech support at AIT was unable to get it working again. It took them 16 days to decide the drive was toast. All data was lost.  Luckily I was somewhat prepared and had been...

February 12th, 2009 by B.Harding 

Fun with site migration

Here is my latest headache: Server Error in ‘/’ Application. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance...

February 11th, 2009 by B.Harding 

Serializing and de-serializing a listbox to XML

In this post I will discuss how I stored a list of strings in a single database field as xml. The application I’m working on has a list of email addresses for each contact. Rather than creating a new table with forgein keys, stored procedures, Data access componants, and business layer logic I decided to take a regular email field and expand it to store a list of emails. My Datastore is SQL...

February 5th, 2009 by B.Harding 

Insert with FormView using Linq

I had a wierd error trying to insert data using a formview today. The jist is this: the formview was trying to use an empty string for an int field instead of Nothing. Here is the error I saw, helpful huh? Failed to set one or more properties on type xxxxxxx  Ensure that the input values are valid and can be converted to the corresponding property types. The fields are allowed to be null but...

February 5th, 2009 by B.Harding 

switch to ssl automatically

In this post I’ll explain how I transparently switch from http to https This same snipit can be put on any page as is and forces certain pages to be https. The nice thing about it is that the user can not edit the url back to http on a page that has this. All I did was put it on the login page and payment page. On page load the server examines the Request.IsSecureConnection flag and redirects...

February 5th, 2009 by B.Harding 

Ajax update panels and the errors that love them.

I have been using ajax a lot lately in my current project. I have noticed an annoying quirk. When a runtime error happens the page appears to hang. temprarily dissabling the update panel quickly reveals that the page isn’t really stuck, but there is an error that ajax is ignoring. I did some research and found a few good examples of how to handle the errors but most were in C# and some didn’t...

February 5th, 2009 by B.Harding 

email a gridview

In this post I’ll discuss how I coerced a gridview control into straight text.  The reason I did this was to send the data from the gridview in an email. An invoice in this case. At first I figured I could use a div and simply tap in to the inner html. No luck! It’s not available on the server side. I’d like to avoid the help of Javascript so I kept looking. I decided to make...

February 5th, 2009 by B.Harding 

Use Css to center a div

Using tables to layout a page is considered outdated. The “new” way to do it is with Div tags a alot of Cascading Style Sheets. To center a table is easy. You just set align=”center”. But what about when using the new way? When you want to center a div in the middle of the page use either a style or a css class to set the following attibutes: width: a fixed width; margin-right:auto; margin-left:auto; Note...

February 5th, 2009 by B.Harding 

What’s the deal with flash videos not working?

A few of my clients have used flash videos in their pages. Out of the box this didn’t work on my server. It was fine in the development environment but once uploaded to production it was a no go. The video just never appeared.  It’s been a while since I learned this trick but it recently popped up again so I figure I sould blog it. On a windows server running IIS flash . swf files that...

February 5th, 2009 by B.Harding 

Automatically reboot an unresponsive Windows Server

My servers are leased so if anything goes wrong and a reboot is needed I have to wait for my provider to preform it. In this post we will create a vb Script that pings an IP address and reboots if it can’t see it. We will simply run it on a timer using the command scheduler. Here is the script: Option Explicit dim strHost ‘The ip address you want to monitor strHost=”111.222.333.444″ if...

February 5th, 2009 by B.Harding