Eseguire ASP.NET vNext su Mac OS con Kulture e Omnisharp

L’articolo descrive come eseguire ASP.NET vNext con sistema operativo Mac OS X. La procedura richiede alcuni passaggi e un po’ di pazienza. Fortunatamente OS X include già il prerequisito Ruby: versione 2.0 su Mavericks/Yosemite, 1.8.7 su Mountain Lion, Lion e Snow Leopard. Sublime Text Un text editor avanzato molto diffuso per Mac OS X è Sublime Text{:target="_blank"}. Personalmente lo uso anche in Windows per sviluppare soluzioni Salesforce.com{:target="_blank"} o per prendere note e redigere articoli in HTML. Altri editor supportati all’epoca della scrittura erano: ...

December 20, 2014 · 2 min · Andrea Azzola

Ichigo, an ASP.NET Blogging Engine

With this post, I intend to leave a trace of the specs of this blog. I started this project in 2008 and never publicly mentioned it. Codename is Ichigo, named after Kurosaki Ichigo, the main character of the manga series Bleach by Tite Kubo. There’s no particular reason for the reference—I just like the manga. Since then, the blog has been a playground to experiment with technologies, including Entity Framework, Dynamic Data, URL Routing, ASP.NET AJAX, jQuery, @font-face, and OAuth. ...

November 12, 2013 · 2 min · Andrea Azzola

Simulating a RequiredFieldValidator with RadComboBox

Telerik’s RadComboBox does not behave like a traditional DropDownList. Instead of a RequiredFieldValidator, you should use a CustomValidator. Here’s an implementation. Step 1: Markup <asp:Label ID="lblExample" runat="server" AssociatedControlID="rcbExample" Text="Example" /> <telerik:RadComboBox ID="rcbExample" runat="server" /> <asp:CustomValidator ID="cvlExample" runat="server" ControlToValidate="rcbExample" Text="*" ClientValidationFunction="cvlExampleValidate" OnServerValidate="cvlExample_ServerValidate" /> Step 2: Client-side validation function cvlExampleValidate(source, args) { args.IsValid = radComboValidate("<%= rcbExample.ClientID %>"); } function radComboValidate(controlName) { var combo = $find(controlName); var text = combo.get_text(); if (text.length < 1) return false; var node = combo.findItemByText(text); if (node) { var value = node.get_value(); return value.length > 0; } return false; } Step 3: Server-side validation protected void cvlStatus_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = rcbStatus.SelectedValue.Length > 0; } Note (2025): This article is from 2010. Telerik’s RadControls have evolved significantly since then; check the current Telerik UI for ASP.NET AJAX documentation for modern practices. ...

October 22, 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

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

Check the MetaModel Existence while Running a Dynamic Data Application

In the web application that I’m developing using Dynamic Data, I set the DataContext at runtime. The application might bind different contexts depending on many variables. I usually test it on two different browsers, and, because of the session, I need to pass the same procedure twice. The second time, the DataContext is already set, so I don’t need to register the context anymore. The simple condition I use: if (System.Web.DynamicData.MetaModel.Default == null) { // Register context and routes ... } Otherwise I would get this exception: ...

June 18, 2008 · 1 min · Andrea Azzola

Set the ConnectionString at Runtime with DynamicData

Note (2025): This article dates back to 2008 and refers to ASP.NET Dynamic Data, which is legacy today. Concepts can still be useful historically, but for modern .NET consider newer frameworks and data‑binding approaches. The following snippet customizes the .NET ConnectionString at runtime in a Dynamic Data application. Edit Global.asax and modify the RegisterRoutes(RouteCollection routes) method. Instead of: model.RegisterContext(typeof(XYZDataContext), new ContextConfiguration() { ScaffoldAllTables = true }); Use: model.RegisterContext( () => new XYZDataContext(connectionString), new ContextConfiguration { ScaffoldAllTables = true } ); Where connectionString is your string value. You can customize the RegisterRoutes parameter collection without compromising application functionality. ...

June 16, 2008 · 1 min · Andrea Azzola

Using an ajax:ModalPopup Without a TargetControl

The ModalPopup extender usually requires a control for firing up, set through the TargetControlID property. However, sometimes you may want to show and hide the panel programmatically. All you need is a fake activator, like the following: The Extender <ajax:ModalPopupExtender ID="mpeInfo" runat="server" TargetControlID="divFakeActivator" PopupControlID="pnlInfo" CancelControlID="bttInfoClose" /> The Panel <asp:Panel ID="pnlInfo" runat="server"> Hello World!!! </asp:Panel> The C# code // Show and hide programmatically mpeInfo.Show(); mpeInfo.Hide(); Note (2025): This post reflects an older ASP.NET AJAX pattern. In modern frameworks you would likely manage modal dialogs through client‑side libraries (e.g., Bootstrap, React, Blazor components). ...

September 25, 2007 · 1 min · Andrea Azzola

Issues With AJAX and a Custom HttpModule

My web app needs to catch every non‑existent path as a search string, because I’m implementing an HttpModule that handles URLs in an SEO‑friendly way, e.g.: http://contoso.com/search-string But the Microsoft AJAX ScriptModule interfered, causing runtime errors like “AJAX Framework failed to load…”. The fix was to register my module after the ScriptModule and selectively bypass AJAX requests. <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, ..." /> <add name="MyModule" type="MyModule" /> using System; using System.Linq; using System.Web; public class MyModule : IHttpModule { public void Init(HttpApplication context) { context.PostResolveRequestCache += Application_OnAfterProcess; } private void Application_OnAfterProcess(object source, EventArgs e) { var application = (HttpApplication)source; var context = application.Context; if (context.Request.Headers["x-microsoftajax"] == null) { if (!System.IO.File.Exists(application.Request.PhysicalPath) && !application.Request.Url.ToString().Contains(".axd") && !application.Request.Url.ToString().Contains(".asmx")) { string newUrl = "~/Search.aspx?q=" + context.Server.UrlEncode(application.Request.Url.Segments.Last()); // other logic here… context.RewritePath(newUrl); } } } public void Dispose() { } } This runs at PostResolveRequestCache and, when the special x-microsoftajax header is absent, it rewrites unknown paths to your search page while letting AJAX handlers (*.axd, *.asmx) pass through normally. ...

June 18, 2005 · 1 min · Andrea Azzola