ASP.NET

ASP.NET Custom Expression Builder For Azure

ASP.NET 2.0 brought a new feature called Expression Builder, which allows you to assign dynamic values to a control’s property. The syntax is very similar to the well known <%= value %> and <%# bind(“property”) %>: <%$ expression %> Please note the “$”. This syntax can be found mostly for connection strings when doing some declarative binding with ASP.NET: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" /> This built in Expression uses the connection string MyConnectionString found in the Web.Config. It is a fact that with Azure it is better to store the AppSettings and Connection Strings in the CSCFG...

posted @ Thursday, September 22, 2011 11:41 AM | Feedback (0)

Dynamic CSS with ASP.NET MVC and ContentResult

The ContentResult class is of type ActionResult, which means it is used to return text content from Controller Actions. There are multiple uses for the ContentResult, and one use is to create CSS dynamically. One would simply point a style sheet to an action and the action would return the dynamically generated CSS. In my case I am developing a Web app where each client can have their own theme, which is set in the database. I tackled this requirement with the following code: 1: public ActionResult CssStyle() ...

posted @ Tuesday, March 01, 2011 12:33 PM | Feedback (0)

Geospatial Article Part 1 on Simple Talk

Part 1 of my Mapping Your Data with Bing Maps and SQL Server 2008 article is now published on Simple-Talk. Go read it and learn how to integrate Bing Maps into your existing or new apps to solve business needs. Happy Reading!

posted @ Wednesday, March 24, 2010 5:13 PM | Feedback (2)

South Florida Code Camp 2010

This year was another great year for the South Florida Code Camp. Lots of people, sessions, speakers, books, software, food, water, sodas, and a great atmosphere. Both of my Programming Web 101 and 201 sessions went great. I had a small problem with time for my 201 session as I was told by a person I had to end by 10:50, when in reality I had until 11. I apologize to everyone who was at my 201 session for not being able to cover the entire presentation. You can download both the presentation and the project files from the following links: Programming...

posted @ Monday, March 01, 2010 11:33 AM | Feedback (3)

Problem Creating a Localized, Embedded Script

I was following this tutorial and was getting the error: Assembly 'AssemblyName' contains a Web resource with name 'ResourceName', but does not contain an embedded resource with name 'ResourceName'. Everything seemed to be perfect except that I forgot to set the JS file to build as an Embedded Resource: Happy Programming!

posted @ Saturday, January 16, 2010 3:42 PM | Feedback (1)

Out of Process Session State and LINQ To SQL Entities

When using ASP.NET you can choose 4 different ways of storing session: In Process, State Server, SQL Server, or Custom. When using In Process the session is stored on the ASP.NET thread of the web server, but when using the State Server or SQL Server the sessions are stored outside the ASP.NET thread. When would you use Out of Process session state? Mostly when you have a web farm and you need to share the same session across all web servers. You might choose to use it even if you have one web server for the simple reason of saving...

posted @ Friday, November 13, 2009 11:56 AM | Feedback (2)

JavaScript not working within UpdatePanel

The other day I was having a problem with JavaScript functions not being found. The simplified setup was similar to this: - UpdatePanel    - UserControl (Visible = true)    - UserControl (Visible = false)       - Embedded JavaScript and Controls There was some controls on the page that triggered an asynchronous postback which changed the visibility of the UserControls and when the Embedded JavaScript was called I was getting JS errors. Here’s the question I asked on the forums: http://forums.asp.net/t/1484503.aspx. According to InfinitiesLoop: The...

posted @ Monday, November 02, 2009 9:03 AM | Feedback (2)

Sample Code for Getting the User Location based on the IP Address

Yesterday I introduced a free service to get the location of the IP Address. If you haven’t read it, go on read that first (it’s very short, I promise). So here I am today, showing you my small .NET API to abstract the XML returned by the service. First we need an object to hold the data. I called it UserLocation. 1: public class UserLocation 2: { 3: public string City...

posted @ Thursday, September 03, 2009 2:01 PM | Feedback (3)

Get Location of the IP Address

I wanted to share with all of you a free service that provides you an approximation of your user’s IP Address. You can read about it here: http://www.hostip.info/use.html. If you are looking for a more sophisticated solution that is maintained more often than the free solution you can also use this service: http://www.maxmind.com As of this writing you can get the response in 2 different forms: XML or plain text. I like the more structure formats so I will be using the XML option. Stay tune… I will post a C# API for retrieving the information. UPDATE:...

posted @ Wednesday, September 02, 2009 3:00 PM | Feedback (3)

Routing in ASP.NET 3.5 and 4.0

Routing was born with the creation of the asp.net MVC Framework. During the beta testing of the MVC framework people started asking for this feature to be included in asp.net so it could be used with web forms as well. The asp.net team listened and included Routing with the release of .net 3.5 SP1. Thanks for the history, but what exactly is routing? Routing enables you to use URLs that do not map to a physical location on the server. For example in a normal page request for the default.aspx resource there has to be a physical file default.aspx...

posted @ Friday, July 17, 2009 7:52 PM | Feedback (0)

Full ASP.NET Archive