IE 10, Chrome and Opera won’t send forms authentication cookie after upgrade to Windows 8

Long story short: The local date was one day in the future. The browser though the 30 min cookie was expired so it didn’t send it on the next request. The messed up part is that Firefox worked just fine… I was raging about Do Not Track being on by default and what-not for no reason. Sorry Microsoft. I’d be nice to have those 2 hours back though…
February 11th, 2013 by B.Harding 

HTTPModule: Redirect a page even if POST ed

My curret project involves an HTTP module that will handle page redirects that are centrally manage by storing them in a database. I want the module also handle redirects for form submits that use both get and post. Get is easy, you just pull off the querry string and tack it back on when you’ve found the new page. Post isn’t so easy. In html when you use <form method=”post”...

October 12th, 2010 by B.Harding 

Truncate a databound string at runtime

So here is the scenario, I want to display the first 25 characters of a text field in a grid. You can do this a few ways such as, truncate when the datasource selects it, alter it on rowdatabound and probably a few others. But I wanted to try to find a way using the a format string. <asp:Label ID="amanotesLabel" runat="server" Text='<%#String.Format("{0}",Eval("notes")).Substring(0,25)%>' it...

December 30th, 2009 by B.Harding 

Copy a generic list, List<>, by ref, by value wierdness

Here is my latest weird problem. I had a generic list, I wanted to  make a copy of it. So the aproach I used was to make the new list = the first one. Enter the wierdness; any mods to the second list showed up in the first one. So I guess it used a pointer or passed it by reference instead of  making a copy like I expected. Live and learn I guess. The work around was to initialize it blank and call...

October 19th, 2009 by B.Harding 
Comments Off on Copy a generic list, List<>, by ref, by value wierdness

Store an IP Address in a human-readable Int64 (bigint)

Lets say you have an  ip address in a string such as  “127.1.2.3” This code will store the information in an int64 (C#) or bigint (SQL) in with three places per octet. 127001002003 The highest this number could go is 255,255,255,255.00 which is too large for a 32 bit integer. Hence the Int64. In SQL an 64 bit Integer is big int so that is what you’ll need to store in an MS-SQL Database. I...

September 29th, 2009 by B.Harding 

Using gridview controls as an asyncPostBackTrigger

Adding an async postback trigger in an aspx page requires you to specify the control ID.  The problem is that the control ID is generated dynamically for items in a gridview row. Not to worry you can still use them. Open the control’s onLoad event and add it there using the control’s Unique ID as the AsyncPostpacktrigger’s ControlID. Done! The unique ID is the instance’s ID...

September 21st, 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 

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