Copying URL’s and MSN in today’s world.

January 4, 2008

2 years ago, If you said to me as a fellow developer, You shouldn’t have a URL longer than 400 characters including the http:// I would have said to you, why? And politely requested that you put up a good enough reason for it. These days I would say,  “yes, you are right!” because I have found a “good enough” reason. MSN! With Instant Messaging being such a growing, common and popular method of communications these days I think it has already surpassed the point where you and I as a developer have to take into account people copy your URL as messages into the msn chat client screen to send to a friend rather than emailing the link.

ASP.NET 2.0 has provided many means of communicating data across pages like cross page posting and using the PreviousPageType directive to get strongly typed properties on the recieving aspx page. I realize that last bit wasn’t very clear so I will attempt to explain how we can avoid query strings using the cross page posting technique.

Let’s say you have a page that accepts collects a substantial amount of personal data called PersonalDetails.aspx. Now consider that there is another page that accepts the data, processes and order and sends the details to securepay. Let this pages name be ProcessOrder.aspx. Within ProcessOrder.aspx’s directive you would add an attribute “PreviousPageType” and point it to PersonalDetails.aspx. Once this is done, make sure you expose all the controls on the PersonalDetails.aspx page with public properties. Finally (you may need to hit build for intellisense to kick in) you now have access to all the properties on the PersonalDetails page from the ProcessOrders page through the PreviousPage property.

Some of you old school asp dev guys may remember that this was easily accomplished by assignging the form’s action attribute to ProcessOrders.asp but this is not able to be done in .net so here is a very nice type-safe solution.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: