Category Archives: .NET

First AWS Elastic Beanstalk .Net Application

Ok, this is very simple. But I have just deployed my first AWS Elastic Beanstalk ASP.NET application. This is not my custom application. But something AWS lets me create with few clicks.

It is very good that they have a Free Usage Tier for about a year to play and get familiar with. I will be deploying a live project sometime soon. But, you should check it out. More details on AWS free tier http://docs.amazonwebservices.com/gettingstarted/latest/awsgsg-freetier/deploy-sample-app.html

As for my free sample AWS Elastic BeanStalk website, click here. It only gets better from here :)

First MVC4 Live Application

I finally got to play with and host a live website, indianchurch.us, built on ASP.NET MVC4 beta. I didn’t get to use all the goodies in MVC4, but it was nice to be able to do a bin deployment using MVC4 Beta dlls.

Currently, it is a very basic website that lets you search Indian Churches in USA. I have few more features in mind and hope to get them out sooner than later. Please feel free to drop any comments.

In addition to MVC4 beta, also got to play with Entity Framework 4.1 Code First for data access, Twitter bootstrap as css framework, Bing Maps for mapping & geo-location, and jQuery.

In a later post, I will try to go into detail of this project and may be one day open source this (I have some cleanup before that).

ASP.NET MVC, JQuery, and SuperFlyDOM

What is JQuery? “A new type of JavaScript Library” Jquery really made my UI developement Fun. If you are not familiar with JQuery, i strongly suggest you check it out. We can do more with less code using JQuery.

And then there is ASP.NET MVC to make make web development clean and TDD friendly. If you are not familiar with ASP.NET MVC you should check out Scott Gu’s Blog posts on different previews (currently Preview 4).

There are quite a few articles on how to integrate ASP.NET MVC and JQuery to make our lifes happier. A simple google search for “ASP.NET MVC with JQuery” return quite a few articles.

Continue reading

Linq to SQL Database Connection String Issue

As i am moving in to hosting my application on an external server, i am finding some interesting and annoying (time consuming for research) things. i will try to address them as they come along…

One of the main thing was the way i handle my Data Layer. My Data Layer is a class library project and I have separate Business, Entity, and UI layers. My Data Layer is done using LINQ to SQL with stored procedures (All my interaction with Database are using Stored Procedures). When i dragged and dropped required tables and stored procedures in to the designer, behind the scenes, the DBML file, (specifically, the DataContext class) hasa default constructor that stores the connection string. To Re-iterate, we have this connection string defined in Web.Config, and app.Config (gets created for class library projects), and this hard coded value in “.dbml” File.

Continue reading

Hosting ASP.NET MVC applications

Ok, i have had FUN working with ASP.NET MVC (the official site, more info on Scott Gu’s Blog) Preview 3. I was doing some fun stuff.  Wanting to  play with different technologies of late, i found (really found) ways to use LINQ (to SQL, to XML, and on Entities). To complement all this i have used JQUERY with very good plugins like “Listen” and “SuperFlyDom”.

This whole thing is very cool and works great on my local machine with Vista Ultimate running IIS7. I was excited and wanted to put it on my hosting account only to realize, my hosting account only supports IIS6 (some cheap Shared Hosting, right!). Now, all my pretty looking URL are going to look bad with that “.MVC” extension, right?. After a quick a google search, i found an interesting idea on doing a ReWrites with ISAPI modules. Having done this a lot in my previous jobs, i assumed the job.

My Host, does not support main ISAPI_ReWrite modules, and kind of suggested me to get “LinkFreeze” from the same company. In my excitement to get my website online, i bought that license (about $50.00) and asked my hosting provider to install and let me know how to set up the configuration i needed to do.

Apparently, this is quite different from the main module and is very limited in what it does. I finally figured (or not) that this is not the right software for what i wanted to do.

Now, i am in the HUNT for Web Host.

Either a decent Windows Serer 2008 Shared Host with reasonable SQL Serever Space or a Virtual Dedicated Windows Server 2003 (then i can install SQL Serer Express).

I would appreciate any feed back with your hosting providers. I have had some bad experiences with couple over this last weekend.

(One Provider went on to say that i can install ISAPI_Rewrite module and assured me that all the things i am asking for are already in the package, only for the Tech REP to tell me, after sign-up, that they don’t support it.) Now, i am canceling that account and asking for a refund. Please share your experience.

The solution i am mentioning about hosing ASP.NET MVC apps with pretty URLs on IIS6 are This ONE and This ONE.

Good Luck Hosting with hosting ASP.NET MVC apps. Microsoft, Could you Please provide us some DEV HOSTING PACKAGES for some decent price to play with new technologies. Thanks!!!

Changing Page Title and Meta Tags with Master Pages

Master Pages are good for so many things. They also cause some confusion on how to have a different page title for each page, how to specify Meta Tags, etc.

This post is neither on Master Pages nor on best practices on handling these two topics. I would try to list couple of simple ways to handle them.

Title:

Title tag in Master Page acts as a place holder. On each page that uses Master Page, specify the “Title” in the page declarative.

In your content page, i.e., (.aspx),

<%@ Page Language=”C#” MasterPageFile=”~/Master1.master” AutoEventWireup=”true” Title=”Content Page Title” %>

You could also change the “title” tag in the code file as follows.

base.Master.Page.Header.Title = “Content Page Title”;

Meta Tags:

Meta Tags are little different compared to setting the page Title. Check the code that creates a meta tag “keywords” with content “ASP.NET, AJAX, Web Services”.

HtmlMeta metaTag = new HtmlMeta();

metaTag.Name = “keywords”;

metaTag.Content = “ASP.NET, AJAX, Web Services”;

base.Master.Page.Header.Controls.Add(metaTag);

If you need to do this in multiple content pages, you might want to have a base page with properties like, “MetaKeywords”, “MetaDescription”, “MetaRobots” etc. So, on your regular page you could set these properties.

AJAX UpdatePanel Causes Postback

Little Known Secrete ” UpdatePanel causes Postbacks”.

Even though it is good entry point in to AJAX programming using .NET technologies, UpdatePanel does not give you much performance over traditional PostBack model.

When used, UpdatePanel causes the postback similar to the traditional postback, instantiates the control tree, and at render time realizes to send only the required response (the content in the updatepanel).

So, apart from the reduced response bandwidth and nice looking flicker free UI, updatepanel is not really getting you much performance.

Having said that, i am sure you can get away with UpdatePanel for most of your needs.

I would try to supplement this with more information.

ASP.NET Url Re-writing and Postback Problem Solution

If you are doing any web-applications, chances are you have heard of Search Engine Optimization, also know as SEO. Its all about getting better search engine ranking for your web-pages.

Even though, there are no fixed rules on what to do, there is a general consensus among web masters, on what helps your search engine rankings. And one of them is having a better URL, in other words, having the key words in your URL using URL Re-writing.

The problem with ASP.NET is that once you do URL rewrite, all your post back would stop working. This has been a dis-advantage when it comes to SEO of your pages. There were few tricks we could have done to have it work, but, they are more of a hack than pretty solutions. I have linked to one of those solutions here a while ago.

But, Now with the advent of CSS control adapters, it is not only very easy to URL rewrite and have the postbacks work but also clean [hack!].

Here is a very nice article on various options on URL rewitting from ScottGu’s Blog

All the solutions offered are very clean and i happen to use the CSS control adapter solution on couple of my sandbox projects,

1) An online classified site for my home state, Andhra Pradesh

2) Online Deal and Coupon Aggregation site

-Cheers,

AJAX Usability Question when the screen is being updated

 

I am working on a simple web application that aggregates RSS from different Online Deal Site in to one place. One of the things I wanted to do was to have one page and load the RSS details in to an Update Panel. I know Update Panel is not the best when it comes to performance but it does its job and with proper caching on the server side, it is very good for my purpose. And more over this blog is not about the merits and/or de-merits of UpdatePanel but on Usability from an end user perspective.

I was using “UpdateProgress” from AJAX control tool kit and it is working very well with simple “update message” while the update panel is being processed. But, there are times when there is not any delay and the “Progress Bar” is not coming up. This may not be the desirable condition as user might not recognize that the screen has new information.

So, I needed some thing more to say that the screen has been updated. I looked in to “UpdatePanelAnimationExtender” to work with the condition. This Extender supports Animations while the screen is being updated and after the update.

 

<cc1:UpdatePanelAnimationExtender ID=”UpdatePanelAnimationExtender1″ runat=”server” EnableViewState=”false” TargetControlID=”UpdatePanel1″>
<Animations>
<OnUpdated>
<Sequence>
<EnableAction Enabled=”true” />
<Color AnimationTarget=”UpdatePanel1″
Duration=”.5″
z-index=”5″
StartValue=”#FFCC99″
EndValue=”#FFFFFF”
Property=”style”
PropertyKey=”backgroundColor” />
</Sequence>
</OnUpdated>
</Animations>
</cc1:UpdatePanelAnimationExtender>

In addition to this I could have another animation to show while the target update panel is being updated with entry like

<OnUpdating>

</OnUpdating>

But I am not sure if this would inform the intended message to the end user! So I have decided to go in-between route. Show the “Progress Bar” while the update panel is being updated and show a simple color transition when the panel is being updated.

To outline the code is looks something like this

<asp:UpdatePanel id=”UpdatePanel1″>

<ContentTemplate>

<asp:UpdateProgress ID=”UpdateProgress1″ runat=”server”>
<ProgressTemplate>
<div class=”ProgressClass”>
Please Wait While the Page is Loading…
</div>
</ProgressTemplate>
</asp:UpdateProgress>

<asp:GridView>

</asp:GridView>

</ContentTemplate>

</asp:UpdatePanel>

<cc1:UpdatePanelAnimationExtender TargetControlID=”UpdatePanel1″>

</cc1:UpdatePanelAnimationExtender>

You could find more about these controls here

-Thanks,

Creating Temporary Projects in Visual Studio 2005

I read about creating temporary project in Visual Studio some time ago and kind of forgot about it. Few days ago, I needed to create a temp project for trying out something really quick.

There is a setting in Visual Studio that lets you create projects in temp directory and not save all the directory structure in to your main folder structure.

Follow these steps in Visual Studio 2005

Tools -> Options -> Projects and Solutions ->

and uncheck “save new projects when created” check box.

Good Luck…