Wednesday, December 15, 2004

VS.NET: Clean Web Form Templates

If your a web site designer/developer like I am, you know that VisualStudio.NET 2003 is great for coding a nightmare for design! One of the problems (and there are many) is the default web form template. When you add a new ASPX web form to a project, you get all sorts of proprietary META tags and the like. Most of these tags are either worthless to a designer or just allow VS.NET to further mess-up your HTML page.

For a very good article on this, reference Milan Negovan's article, "Remastering Web Form Templates". His article points-out many of the frustrations of the VS.NET web form designer, and provides a link to a tool he created that can help you generate clean web form templates.

However, I find that going to his web site to use his tool wasn't likely going to happen (I'm too lazy!)... I wanted to know if I could modify the default VS.NET template so it always creates exactly what I want. I found the default ASPX web form template (VB) here:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\WebForm\Templates\1033\WebForm.aspx

I removed the default VS.NET specific meta tags and added my own, such as a copyright, author, etc. Need some help coming-up with the default META tags? Try AnyBrowser.com.

Tuesday, December 14, 2004

Sometimes Post-Back Isn't an Option

When switching from ASP to ASP.NET years ago, it took me a long time to get adapted to posting-back a form. To this day, I still find reasons why using post-back is more of a pain than a help, such as adding a search text box to every page in a web site... a problem I'm having with my current project.

To solve this problem, I did a little research and found-out a nifty way to post form information from one ASP.NET page to another:
Server.Transfer("WebPostAway2.aspx", true)
Although using Server.Transfer isn't new to me, I never knew about the second parameter, preserveForm! Setting preserveForm to True keeps all the post data intact as it's passed to the next ASPX page.

Friday, December 10, 2004

No More Ugly Submit Buttons

Depending on which browser and operating system you are using, the submit buttons on a web form can either look really pretty or really ugly... the default is really ugly (gray blocks with black text.) Granted, using CSS on a button can pretty-them-up somewhat, but this CSS trick is the best by far!

[CSS]

input.btn{
color:#050;
font-family:'trebuchet ms',helvetica,sans-serif;
font-size:84%;
font-weight:bold;
background-color:#fed;
border:1px solid;
border-top-color:#696;
border-left-color:#696;
border-right-color:#363;
border-bottom-color:#363;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0,StartColorStr='#ffffffff',EndColorStr='#ffeeddaa');}
For details on the original article: WebReference.com: Stylish Buttons

Thursday, December 09, 2004

Windows XP: Get That Crap Out of My System Tray!

Why is it that every software manufacturer feels that their software must:
  • Install a shortcut in 1,700 places on my PC?
  • Run at startup?
  • Create a useless app that runs in my PC's system tray with no option to disable this feature?

As of recently, I was able to speed-up the boot-up time of PC a little by removing many of the links to the programs that thought they needed to run at start-up (and I didn't.) The hard way to do this is to go to Start > Run > Type in "MSCONFIG" > Startup Tab. From there, you can try and decifer what it is that is running on your PC when it boots-up. If you find some programs you think should not be run at startup, you can use the RegEdit tool to remove the entry in the Registry that starts that app.

However, there is an easier way (of course!) System Internals offers a free application called AutoRuns that is really easy to use, and makes removing unwanted start-up apps a breeze! Once the app runs, it lists all the applications that choose to run on start-up, and shows you who manufacturered the application. By right-clicking on the application, you can delete it or go directly to the spot in the Registry where the reference is located.

Warning: It is quite easy to remove programs your PC actually needs at start-up using either of the above methods! Do not even bother using this tool if you aren't a geek! ;)

Wednesday, December 08, 2004

Windows XP: No More Error Reporting!

For the longest time, I thought that those stupid "Do you want to report this error to Microsoft?" pop-up that showed-up after a program crashes were just something I had to live with... NOT!

To turn Error Reporting "Off":
  1. Right-click on the My Computer icon
  2. Select Properties from the menu
  3. Select the Advanced tab
  4. Click the Error Reporting button
  5. Select the Disable Error Reporting radio button
  6. Click OK and you're a happy-camper!

Tuesday, November 23, 2004

How to Disable IE AutoComplete in HTML Forms

Using Microsoft's Internet Explorer AutoComplete feature may save a lot of time on your personal PC or in an Intranet environment, but it can be a dangerous thing when creating web applications that involve sensative information. For example, if a user accesses your application at a web cafe and has AutoComplete turned "on", then walks away from the computer, the next person has free reign.

Fortunately, there is a simple solution to this problem. Just add the AutoComplete attribute to either the <form> tag or the <input> tag:
<form AUTOCOMPLETE="OFF">

... or...
<input type="text" name="name" AUTOCOMPLETE="OFF">


Sometimes the AutoComplete feature is a good thing, however, like in an Intranet environment where a user may have to enter the same information over and over. To better control this information as a web developer, the following article gives a good description of what you can do:

Developer's Dex: AutoComplete Feature of Internet Explorer

Tuesday, November 16, 2004

User.Config File

For those of you who wish there was a nice way to modify a web site project and not have to worry about changing workstation specific configuration settings in the web.config file (like datbase connection strings, etc.) you can use the file="user.config" attribute of the <appsettings> tag.

You can do the following in web.config:
<configuration>

<appsettings file="user.config">
<add key="Key" value="Value" >
</appsettings>
</configuration>
Then, create a file called user.config in the same folder as web.config, and paste the following code. Notice that there is no <configuration> tag:
<appsettings>

<add key="Key" value="Override value" >
<appsettings>

Do not add the user.config file to the project. If there is no user.config in the same folder, then the web.config settings are used.

MSDN:Web Projects Source Control Integration In VisualStudioNET