Import Web Service References in .NET

Note (2025): This post refers to .NET Framework 2.0 era tools such as wsdl.exe. Modern .NET projects generally use Connected Services in Visual Studio or dotnet svcutil. The example is preserved for historical reference. You may need to consume Web services from client applications. Visual Studio provides tools for generating proxy classes, which in some cases may be insufficient. In those cases, the wsdl.exe tool is an alternative. The wsdl.exe tool You can use the command prompt tool wsdl.exe, included within the .NET Framework 2.0 SDK. This tool accepts the path to a WSDL file and generates the proxy class automatically. ...

June 9, 2010 · 1 min · Andrea Azzola

How to Log HTTP Requests with PHP

Note (2025): This post was written in 2010. The sample uses ereg, which has been deprecated in PHP 5.3 and removed as of PHP 7. Use preg_match or other modern approaches for production code. The article remains here for archival and historical interest. Sometimes you need to understand precisely how the HTTP request is submitted to the server. If you’re working with Salesforce.com, you probably don’t have easy or intuitive tools to understand how a message is serialized and sent by the runtime to the server. ...

May 27, 2010 · 1 min · Andrea Azzola

Improve ASP.NET SEO by using System.Web.Routing

This page is specific to Microsoft Visual Studio 2008/.NET Framework 3.5 or higher. SEO and ASP.NET “As an Internet marketing strategy, SEO considers how search engines work and what people search for. Optimizing a website primarily involves editing its content and HTML indexing activities of search engines.” — wikipedia.org Search Engine Friendly URLs vs “Dirty” URLs Example: SEF URL: http://AndreaAzzola.com/seo-asp-net-routing RAW URL: http://AndreaAzzola.com/Post.aspx?id=cd171f7c-560d-4a62-8d65-16b87419a58c SEFs are better to write, remember, understand, and maintain. In the example above you can immediately understand what the resource is about, while the RAW version is difficult to read and almost impossible to remember. ...

January 18, 2010 · 3 min · Andrea Azzola

Call async methods with C#

Note: This article was originally written in 2009 and may be obsolete due to C# technology improvements. This article shows how to delegate work to an asynchronous thread in C#, allowing for code execution and app responsiveness. You might go a step further by implementing error notifications, polling, or waiting for the procedure to complete at a certain point. Suppose you have the following method: public void UploadFile(string path) { try { //... uploads some file to the server } catch(Exception ex) { // ... handle errors } } And you are implementing it as a web service: you are asked to give an immediate response and upload the file asynchronously, as the user won’t need the upload immediately. ...

October 15, 2009 · 1 min · Andrea Azzola

POST data with JavaScript

Note (2025): This article dates back to 2009. The examples remain useful, though modern apps often prefer fetch()/XHR or form submissions driven by frameworks. The classic form‑build approach below still works universally. HTML 4.0 (W3C) defines how browsers submit forms: GET: append query string to the action URL (application/x-www-form-urlencoded). POST: send a request body to the action URL, using the content type indicated by enctype. Programmatic POST helper Add this in your page head: ...

July 7, 2009 · 1 min · Andrea Azzola

JavaScript Auto-collapsing Notification Panel

Note (2025): This article was originally written in 2009. The example code (inline onclick, manual style.display changes) reflects practices of that era. Modern JavaScript uses event listeners, unobtrusive DOM manipulation, and CSS transitions. The post is kept here as an archive and for historical interest. In almost all web applications comes the moment when it becomes necessary to show some notifications to the user. A common practice in the past, even when elegance was unimportant and web pages didn’t show much dynamic behavior, was the use of the method alert() from JavaScript. ...

May 29, 2009 · 1 min · Andrea Azzola

Get and Set Radio Controls Checked Value with JavaScript

Suppose you have the following radio controls: <input name="Book" type="radio" value="asp" checked="true">ASP .NET</input> <input name="Book" type="radio" value="wcf">Windows Presentation Foundation</input> <input name="Book" type="radio" value="slg">Silverlight 2.0</input> How do you get the selected value via JavaScript? As you can see in the example, radio controls are declared with a name attribute (not an id). The browser treats each radio input as a different element, but the common name value groups them logically. The getElementsByName Method W3C Documentation — This method allows you to obtain a collection of controls from the DOM by specifying the common name value. ...

March 20, 2009 · 1 min · Andrea Azzola

Clean Up Stored Procedures Cache with SQL Server

When deploying a stored procedure, cleaning up the database’s cache can help apply changes immediately. Have a look at the following code: -- Cleans up db's cache DECLARE @dbID INTEGER SET @dbID = (SELECT dbid FROM master.dbo.sysdatabases WHERE name = 'DBNameHere') DBCC FLUSHPROCINDB (@dbID) The DBCC FLUSHPROCINDB command allows specifying a particular database id, and then clears all the plans from it.

March 6, 2009 · 1 min · Andrea Azzola

Handle Multiple Columns as One with Dynamic Data

Sometimes you need to schedule tasks in ASP.NET and save both a Start Date and an Interval, stored respectively as DateTime and TimeSpan.Ticks in your database. Editing raw tick values is not exactly good UX, so I bound the proper MetaColumn to the proper UIHint. After some tests, I noticed the GUI was functional but not as intuitive as expected. The solution was to customize the FieldTemplateUserControl of Dynamic Data, to display and save multiple columns I needed (Start Date, Start Time, Occurs – Daily, Weekly, Monthly, etc.). ...

November 2, 2008 · 1 min · Andrea Azzola

Allow the Upload of Large Files with ASP.NET

When working with ASP.NET you may need to increase the default limit for file uploads. By editing the Web.config file you can allow larger payloads. Example configuration: <configuration> <system.web> <httpRuntime executionTimeout="240" maxRequestLength="16384" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" /> </system.web> </configuration> This configuration allows the upload of files up to 16 MB. Note (2025): The default settings and limits may have changed in more recent versions of ASP.NET/.NET. Check the Microsoft documentation for updated guidance. ...

June 24, 2008 · 1 min · Andrea Azzola