Posts

Showing posts from 2011

Duplicates on postback in your ASP.net Dropdown Box

Let's say you are working on a dropdown box letting the user select a state and a county. You might want to have the county be filtered by the state, so you add an autopostback event to the state dropdown. Let's also say, however, that you are allowing the search to proceed without selecting a county, so you add <asp:listitem Text="All Counties" Value="" /> as your first item and add appendDataBoundItems="True" to your counties dropdown. Because you have now enabled autoappend, the act of changing the state will cause a postback and keep appending counties to your county dropdown box. The solution? Add EnableViewState="False" to your Counties dropdown box. Yes, this may be obvious for some, but it's an easy thing to overlook and can lead you down a rather complex road of coding around viewstate that you may not want to explore.

SSL showing non-secure in some browsers?

Image
I have had a few cases recently where a customer will complain about a specific browser giving them a non-secure connection, or mix-ed mode error on some browsers. Most commonly, older versions of IE are the culprits, but I have seen a case where Firefox 4 showed a page as non-secure while IE8 and 9, Chrome and Safari all had no issues with it. When your customers are banks, you want to make sure even their customers running obsolete IE6 and IE7 browsers see the padlock, despite the other mountain of issues involved with supporting older browsers. Any one little item can be the culprit. Some browsers don't consider certain connections to be an issue, while others do. The obvious things to check first are script source paths for js libraries, etc... Make sure those are using https. As of the time I am writing this, embedded Google maps cannot be on an SSL page. However, when all else fails and you find yourself sifting through nested js files and searching for image source paths tha...

Store ASP.net membership roles in SQL Server

Setting up ASP.net membership roles is a breeze, but if you want to use SQL server to handle the authentication you need to make a few changes. After looking up the syntax repeatedly, I decided to create a mini step by step that includes what changes need to be made in the web.config, the sql permissions and how to set up users / roles. Assumptions: You have a working Visual Studio project and a SQL server connection working. Using: Visual Studio 2008 / ASP.net 3.5 project SQL Server: 2005 Step 1 From the command line (running as administrator) From: Windows\Microsoft.NET\Framework\v2.0.50727\ aspnet_regsql.exe -E -S lrswsqlt1 -d  databasename -A all -sqlexportonly c:\membership.sql Step 2 In SQL Server Execute the SQL created in c:\membership.sql GRANT EXECUTE TO  dbuser Step 3 Modify the web.config (This assumes you already have a working sql connection string in place) Under the <machineKey... tag /> <authentication mode="Forms"> <forms cookieless="Use...

Convert a LiveCycle Form back to an Acrobat Form

Image
PDF Forms that were saved with Adobe LiveCycle cannot be programatically filled and flattened using most API's, like ActivePDF. However, you can convert your LiveCycle PDF form back into a static PDF. 1. Open the form in LiveCycle and save it as Adobe Static PDF form. (Example using Acrobat X Pro) 2. Download PDFTK  http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/ 3. Remove extra XML data with the following command line. I copied the creditApplication.pdf file to the same folder. "pdftk creditApplication.pdf output test.pdf drop_xfa" 4. Now you can open the form in Acrobat and rename the forms fields. By default, the conversion might append form[0] stuff to the field names, so I rename them. 5. Save the new PDF using "Save As". Choose "Adobe PDF Files, Optimized (*.pdf)" and in the optimizer window, make it compatible with Acrobat 4.0 and later. 6. You now have a form fillable PDF that you can use programatically and will flatten properly. [gallery ...