Sunday, June 29, 2008

Restricting user to visit previous pages after user logs out

Its have been a crital task for me for a variety of web aps for restricting users to visit previous pages after he logs out. I have did a lot of research and got many solutions, from using meta tags, to altering the request's headers etc. but the best way I found is by suing Java script along with these mentioned methods.

Particularly using two or more methods make the solution fool proof..
I will write a detailed article on this sub. soon till intereste dfolks should read this good java script resourse...

Some more relevant posts resourses over the net:
Pragma: No-cache" Tag May Not Prevent Page from Being Cached

how could I disable the browser's back button using javascript?
About the only way you can do this is to open a new window using (specifying that the browser history should not be copied to the new window) and then close the existing one.

It can be done in 4+ browsers but it doesn't really disable the back button, just erases the data behind it to an extant.

replace Method
The replace method replaces the current History entry with the specified URL. After calling the replace method, you cannot navigate back to the previous URL using the browser's Back button.

Syntax: location.replace(URL)

This will replace the history with the current link every time a link is clicked

function getTag(el,str) {
while ((el!=null) && (str.indexOf(el.tagName + ":")<0))
el = el.parentElement
return el

function navigateTo(sURL,target) {
if ((target == '_self') | | (target=="")) {
return false;
if (target == '_top') {
return false
if (target =='_parent') {
return false;
if (target == '_blank' | | parent.frames.length < 1) {, target);
return false;
else {
if (parent.frames[target])
else, target);
return false;

function checkIEClick() {
var el = getTag(event.srcElement,"A:AREA:")
if ((el!=null) && ((el.tagName=="A") | | (el.tagName=="AREA"))) {
event.returnValue = false

function checkNSClick(ev) {
if ( {
return false


if ((document.all) | | (document.layers))
if (document.layers) {
document.onclick = checkNSClick
document.onclick = checkIEClick

A little slick redirection:

var version = parseInt(navigator.appVersion)
// replace is supported
if (version>=4 | | window.location.replace)
window.location.href = "newPage.htm"
// -->
The document, <A HREF="newPage.htm">Scott's Home</A> has moved.

The above code was found at Site Experts. I hope it is useful.
Wayne Luke - Sitepoint Forums Administrator

Here are some work arounds but not fool froof as the auther him self says:


Friday, June 27, 2008

Microsoft Certifications

Microsoft Certifications are standard for giving you recognition in the IT market.
There are different series and certification tracks in different streams of job profiles.

Learn more about Microsoft Certifications here:

New Generation Certification Exam Map:

Certification Exam guide:

MCTS: Microsoft Certified Technology Specialist:

Preparation Guide for Exam 70-528

Few Internet Tips

Get few good internet tips here :

Inner working of Exception

Here is the best ever article to let us understand how Exceptions work and are handeled internally.

Debugging the Visual Studio

Read some good articles here

My feed for the blog at FeedBurner

My feed for the blog at FeedBurner

My feed for the blog at FeedBurner

Tuesday, June 24, 2008

ASP.NET Is a Leaky Abstraction

ASP.NET Is a Leaky Abstraction:

In teaching someone about ASP.NET programming, it would be nice if I could just teach them that they can double-click on things and then write code that runs on the server when the user clicks on those things. Indeed ASP.NET abstracts away the difference between writing the HTML code to handle clicking on a hyperlink () and the code to handle clicking on a button. Problem: the ASP.NET designers needed to hide the fact that in HTML, there’s no way to submit a form from a hyperlink. They do this by generating a few lines of JavaScript and attaching an onclick handler to the hyperlink. The abstraction leaks, though. If the end-user has JavaScript disabled, the ASP.NET application doesn’t work correctly, and if the programmer doesn’t understand what ASP.NET was abstracting away, they simply won’t have any clue what is wrong.

– Joel Spolsky, The Law of Leaky Abstractions, November 11, 2002

Visual Studio Shortcuts

Find some really good Visual Studio Shortcuts here

Creating great thumbnails in ASP.NET

Found some great articles / codes for
Creating great thumbnails in ASP.NET here

Generating image thumbnails in ASP.NET

GD Sharp Wrapper Engine
GD-Sharp is a .NET wrapper for the GD Library, developed with mono for Linux and Windows.

ASP.NET Tips, Tricks, Recipes and Gotchas From ScottGuu

Visual Studio 2005

* Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005
* Common Gotcha: Slow VS 2005 Web Site Build Performance Because of “Dueling Assembly References”
* Common Gotcha: Public Hotfix available for Slow Debugging Problems
* Tip/Trick: Changing the default browser used in VS 2005 and Visual Web Developer
* Tip/Trick: Creating Packaged ASP.NET Setup Programs with VS 2005
* Resource: VS 2005 Web Application Project Tutorials
* Recipe: Using VS 2005 Web Deployment Projects
* Tip/Trick: Custom formatting HTML in Visual Web Developer and Visual Studio 2005
* Tip/Trick: Fast HTML Editor Navigation within VS 2005
* Tip/Trick: How to Run a Root “/” Site with the Local Web Server using VS 2005 SP1
* Tip/Trick: Creating Re-Usable Project and Item Templates with VS 2005
* Tip/Trick: Creating Sub-Web Projects using the VS 2005 Web Application Project Option
* Tip/Trick: Spell Checker Plug-in for VS 2005 for ASP.NET and HTML Pages
* Tip/Trick: Using IIS7 on Vista with VS 2005
* Gotcha: Fixing Error with VS 2005 SP1 Beta and older Web Application Project Templates


* Tip/Trick: Enabling URL Rewriting with ASP.NET
* Tip/Trick: Using Server Side Comments with ASP.NET 2.0
* Tip/Trick: Use the ASP.NET 2.0 CSS Control Adapters for CSS friendly HTML output
* Tip/Trick: How to Register User Controls and Custom Controls in Web.config
* Recipe: Dynamic Site Layout and Style Personalization with ASP.NET
* Tip/Trick: Advanced Article on ASP.NET 2.0 Master Pages


* Tip/Trick: Handling Errors with the UpdatePanel control using ASP.NET AJAX
* Tip/Trick: Cool UI Templating Technique to use with ASP.NET AJAX for non-UpdatePanel scenarios
* Links: ASP.NET AJAX and ASP.NET AJAX Control Toolkit Articles
* Gotcha: Lost HTML Intellisense within ASP.NET AJAX Controls
* Gotcha: Don't use with ASP.NET AJAX
* Tip/Trick: UpdateProgress Control and AJAX Activity Image Animations
* Tip/Trick: Nikhil's WebDevHelper Utility and ASP.NET AJAX Support


* Tip/Trick: How to Upload a .SQL file to a Hoster and Execute it to Deploy a Database
* Tip/Trick: Deploying a SQL Database to a Remote Hoster Environment
* Tip/Trick: Online Database Schema Samples Library
* Recipe: Great ASP.NET 2.0 Data Tutorials
* Recipe ASP.NET 2.0 RSS Tool-Kit
* Recipe: Paging through lots of data efficiently (and in an Ajax way) with ASP.NET 2.0
* Recipe: Efficient Data Paging with the ASP.NET 2.0 DataList Control and ObjectDataSource
* Tip/Trick: ListControl.AppendDataBoundItems Property in ASP.NET 2.0


* Resource: ASP.NET 2.0 Membership, Roles, Forms Authentication, and Security Resources
* Recipe: Enabling Windows Authentication within an Intranet ASP.NET Web application
* Recipe: Implementing Role Based Security with ASP.NET using Windows Authentication and SQL Server
* Recipe: Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005
* Tip/Trick: Integrating ASP.NET Security with Classic ASP and non-ASP.NET URLs
* Gotcha: Always set the "applicationName" property when configuring ASP.NET 2.0 Membership and other Providers
* Common Gotcha: Don't forget to when adding providers
* Tip/Trick: Source/Documentation for Simple ASP.NET 2.0 SQL Providers Published
* Tip/Trick: Guard Against SQL Injection Attacks
* Tip/Trick: Gathering Custom User Registration Information
* Recipe: How to add a Login, Roles and Profile system to an ASP.NET 2.0 app in only 24 lines of code
* Gotcha: Authorization with the built-in VS 2005 Web Server (aka Cassini)
* Gotcha: Forms Authentication timeout default changed between ASP.NET 1.1 -> ASP.NET 2.0
* Tip/Trick: How To Share Authentication Cookies across ASP.NET V1.1 and ASP.NET V2.0 Applications
* Tip/Trick: Enabling SSL on IIS 7.0 using Self Signed Certificates


* Gotcha: Don’t run production ASP.NET Applications with debug=”true” enabled
* Tip/Trick: Automating Dev, QA, Production Web.Config Settings with VS 2005
* Tip/Trick: Creating Packaged ASP.NET Setup Programs with VS 2005
* Tip/Trick: Patterns and Practices Guidance Explorer for .NET and ASP.NET
* Tip/Trick: App_Offline.htm and working around the "IE Friendly Errors" feature
* Tip/Trick: Show Detailed Error Messages to Developers (and only to Developers)
* Tip/Trick: Logging ASP.NET Application Shutdown Events


* Tip/Trick: Implement "Donut Caching" with the ASP.NET 2.0 Output Cache Substitution Feature
* Tip/Trick: Disk Based Output Caching Feature Now Available for ASP.NET 2.0
* Tip/Trick: Cache Manager

.NET 3.5 and VS 2008

* VS 2008 Multi-Targeting Support
* VS 2008 JavaScript Intellisense
* VS 2008 JavaScript Debugging
* VS 2008 Code Editing Improvements
* VS 2008 Nested Master Page Support
* VS 2008 Web Designer and CSS Improvements
* VS 2008 Vertical Split View Support
* VS 2008 ASP.NET AJAX Control Extenders
* ASP.NET ListView Control (Part 1: Building a Product Listing Page with Pure CSS)
* ASP.NET AJAX in .NET 3.5 and VS 2008

LINQ and .NET 3.5

* LINQ to SQL (Part 1 - Overview)
* LINQ to SQL (Part 2 - Defining our Data Model Classes)
* LINQ to SQL (Part 3 - Querying our Database)
* LINQ to SQL (Part 4 - Updating our Database)
* LINQ to SQL (Part 5 - Binding UI using the asp:linqdatasource)
* LINQ to SQL (Part 6 - Retrieving data using stored procedures)
* LINQ to SQL (Part 7 - Updating our database using stored procedures)
* LINQ to SQL (Part 8 - Executing Custom SQL Expressions)
* LINQ to SQL (Part 9 - Using a Custom LINQ Expression with the control)
* LINQ to XML (How to Build a Custom RSS Reader with it)
* New Language Feature: Automatic Properties, Object Initializer and Collection Initializers
* New Language Feature: Extension Methods
* New Language Feature: Lambda Expressions
* New Language Feature: Query Syntax
* New Language Feature: Anonymous Types
* Recipe: Tagging Data using LINQ
* Null Coalescing Operator and using it with LINQ


* My Silverlight Overview Post
* My "Lap Around Silverlight" talk from TechEd
* Building Silverlight Applications using .NET
* Tip/Trick: Supporting Full Screen Mode with Silverlight
* VS 2008 JavaScript Intellisense for Silverlight


* Resource: Credit Card Payment Processing with ASP.NET
* Tip/Trick: List Running ASP.NET Worker Processes and Kill/Restart them from the command-line

LINQ and LINQDataSource

LINQ and LINQDataSource
Visit this must read tutorial from ScottGu

Monday, June 16, 2008

Setting fevicon and shortcut icon for your website

use this code in head section of your HTML/ ASP / ASPX file :

http://Your_Favicon_Url" rel="shortcut icon" />
http://Your_Favicon_Url" rel="icon" />

Few Interesting Dot Net Articles

Check out Few Interesting Dot Net Articles here:

Sunday, June 15, 2008

Tutorial : Sending E-mail using through Gmail account (Gmail SMTP Server account)

Sending Email is a basic task of a web application for many purposes like- Error logging, Reporting, Newsletters, and Performance alerting as well as for many other reasons.

If you have taken web space somewhere on a web server then you are provided with the Email accounts and SMTP and POP services for sending and receiving E-mails. Some times you don't have SMTP server accounts and you may want to send email. Or Sometimes, for other reasons also you may want to use third-party SMTP sever for sending E-mails .

Gmail is a good solution for this purpose. Gmail provides SMTP and POP access which can be utilized for sending and receiving E-mails.
Here in this tutorial we will be using a Gmail account for sending email by SMTP.

1. Gmail has a fixed number of quota for sending emails per day, means you may not be able to send unlimited number of e-mails using Gmail due to anti-spamming restrictions.

2. You may not be able to send same e-mail to unlimited number of people, because Gmail's anti-spamming engine restricts for this too.

So, Gmail can be used for sending limited number of e-mails daily to select people only. If you still need to send numerous e-mails to numerous people you can register for a Google Group account and can use that e-mail address to send email to registered members of that group. I will come up with that tutorial in near future.

1. An active Gmail account is required to test this application.
2. Visual Studio 2005

Here we go:

Step 1:
Create a new web application in visual studio and add a Web form to it.
Next add a Button to the form and double click this button to bring the code for click event of this button in the code window. Copy paste the following code to the click event.

Note: Don't forget to replace the To and From fields as well as the correct password for successfully sending the mail.

string from =; //Replace this with your own correct Gmail Address

string to = //Replace this with the Email Address to whom you want to send the mail

System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();


mail.From = new MailAddress(from, "One Ghost" , System.Text.Encoding.UTF8);

mail.Subject = "This is a test mail" ;

mail.SubjectEncoding = System.Text.Encoding.UTF8;

mail.Body = "This is Email Body Text";

mail.BodyEncoding = System.Text.Encoding.UTF8;

mail.IsBodyHtml = true ;

mail.Priority = MailPriority.High;

SmtpClient client = new SmtpClient();

//Add the Creddentials- use your own email id and password

client.Credentials = new System.Net.NetworkCredential(from, "Password");

client.Port = 587; // Gmail works on this port

client.Host = "";

client.EnableSsl = true; //Gmail works on Server Secured Layer





catch (Exception ex)


Exception ex2 = ex;

string errorMessage = string.Empty;

while (ex2 != null)


errorMessage += ex2.ToString();

ex2 = ex2.InnerException;


HttpContext.Current.Response.Write(errorMessage );

} // end try


Note: Don't forget to replace the To and From fields as well as the correct password for successfully sending the mail.

Step 2: Run the web application and click on the Button to send the mail. Check the E-mail whether you get the mail successfully or not.

Some-times it takes 2-3 minutes or more to reach the mail to the destination server. So check after a while, if you do not get it soon.

Get back to me if you are not able to execute the application. I will be happy to help you out.

Java Pattern and Practices

Java is a vast language that has initiated many new coding patterns and practices.
I have been fond of Java programing though my productivity centralizes on Dot Net Platform.

Here I found many of the patterns and practices documented / listed at a single place.
It can be a good repository for learners :

How to get all the (nested ) Inner Exceptions in the chain

Much of the time for a programer, it is more helpful to know about the inner exceptions occurred while performing a certain operation. In c# its much easy but less utilized technique for getting all the nested exceptions occurred. Getting all the exceptions is also more helpful in error logging and debugging. Below is the technique defined...

// the target code that might raise exceptions
catch (Exception ex)
Exception ex2 = ex;
string errorMessage = string.Empty;
while (ex2 != null)
errorMessage += ex2.ToString();
ex2 = ex2.InnerException;

// output or save the full error message based on your case
//Response.Write (errorMessage); //or
// Console.WriteLine(errorMessage);

Friday, June 13, 2008

LINQ to SQL Samples- Must Read

I found this good repository of samples on MSDN on the topic : LINQ to SQL Samples
Useful for the beginners willing to learn LING.

LINQ is Languages Integrated Query that has been ported with Dot Net Framework 3+ and is a part of Visual Studio 2008.

Here is an another introductory article from on LINQ and XML

String Formating

String Formating has been quite useful and everyday occurring task in a programmers' life.

I have fond many useful reference out there on the web. I am sharing some of them here and will be updating this same post when I find any useful reference for this same topic.

Best place on MSDN for learning about String Formating

Standard Numeric Format Strings

NET Format String 101

Good String Handling Description and reference blog:

Some Hacking / Anti hacking tools

here are some Hacking / Anti hacking tools to download

Thursday, June 12, 2008

Banglore - 2nd place in IT arena


As per the latest global tech spot list of, Bangalore is only next to Silicon Valley. lists the top 20 global hot spots

  1. Silicon Valley
  2. Bangalore
  3. London
  4. Tokyo
  5. Boston
  6. Cambridge
  7. Shanghai
  8. Tel Aviv
  9. Seoul
  10. Beijing
  11. Chennai
  12. Pune
  13. Singapore
  14. Helsinki
  15. Moscow
  16. Hong Kong
  17. Hyderabad
  18. New York
  19. Sydney
  20. Shenzhen

India & China have 4 each; US has 3 and UK has 2; while Australia, Finland, Israel, Japan, Korea, Russia and Singapore have 1 each.

Interestingly America has 3, Europe has 4, Middle East has 1, Australia has 1 while Asia has 11!

Blogs I read

Today I saw this bog, its a bit interesting....

Wednesday, June 11, 2008

Creating a HTML editor in

Creating a HTML editor in has been a herculean task in web applications
here is a working and tested solution at Code Project.

Expanding Grid View using Java Script

A good article here at Code Project describing about :Expanding Grid View using Java Script.
Was useful for me.

Beginner Article : How to make a website fast

I read a good articles for that might be useful for beginner / novice Web developers here at Code Project.

Author describes about how page requests are fulfilled, DNS working, functioning of CSS, Java Script etc. and how to speed them fast and much more...

Visit to this page will be worth..
Happy Reading

Sunday, June 8, 2008

Design Guidelines for Exceptions


Some good articles


Saturday, June 7, 2008

How to be safe from Spaming

Always follow these rules for being safe from Spams:

* Never mention your personal and professional Email address in any of the Discussion forums, news groups, chat rooms, scraps[orkut], or in soical networking sites.
  • Remove /hide your email address- if you have mentioned it in the "Profile" Section of any of the website you use, like- Orkut, Hi5, MySpace, Blogpost, Yahoo profile etc...
* Use a different Email ID other than your personal or professional Email ID to register for newsletters
* For registering at different sites use a constant email address something like and redirect the mails coming to this Id to a predefined folder (Yahoomail) or mark it with a label(Gmail). Create Rules for this available in settings of every e-mail services.

* When disclosing your email address in public use a different email address other than your personal e-mail address.
* If you are a Yahoomail user, use a feature provided by yahoo called "Disposable mail". This allows you to create e-mail aliases. You can use different aliases for different purposes, like for registration purposes create an address like, for public sharing your ID create an address like The add-on is that you can redirect the mails sent to you in a predefined folder and when you start to get spams on that address you can simply delete that email-alias and enjoy to get certain for not getting any spams further on that email address.
  • NEVER NEVER forward emails sent to you to all of you in your address book or a group of people in the address book just for fun. If required, forward the mail to only selected people.
  • When you do So, you send an open invitation to the spammer to spam you as all the addresses mentioned in the TO or CC or BCC fields are sent to the spammer as well.
  • You can Also copy paste the content and compose a new email from the old message for being safe
I will be sharing some more email security tips as time allows...

Spamming...nightmare to everyone

Spamming has been a real nightmare to everyone from the days the webmail has been popular.
Some years back when I was in high-school, I was much disturbed by spamming as I started getting hundreds and hundred of spam mails all of a sudden.

The reason was, I had registered myself at some websites and shared my ID in some discussion groups. Spammers' spiders figured out my Email address and I was bumbarded with the spams that all contained ads and obscene contents.

Inspired by the personal necessity then, developed a software called "Spamocide" for controlling spams on the Internet. The main idea working behind the scene was to create a continually growing "black-list database" of spammers and use that for identifying spams or even stopping directly the spammers to send spams. The product had initial success and i showed the product in some national level software exhibitions but further I did develop it as I was much busy then in my studies.

Those was the initial days when spamming had just been started on the net and my idea and the software worked fine. But Now the scene has been totally changed as day by day new methods and techniques of spamming arouse. All the major web-mail service providers and E-mail client (software) vendors have their "Anti-spam" cell and department which continually fight spam.

Google has been successful in providing web-mail service with better spam-identification and removing features. I conducted a personal test for spamming with all the major web-mail vendors like Gmail, Yahoomail, Sify, Rediff and few others and the best performance for identifying spams was of Gmail. So I trust Gmail for all my personal and professional communications.

I continually do study on spamming and anti-spamming world of technologies.
Domain-key and SPF has been trusted algorithm for identifying the spammers' domain.

Recently I read this article , actually a research paper of one of the Gmail-guy. He describes how the Google identify the spammers' domain. Read it here.

I will be sharing on spamming and anti-spamming in days to come.
Ant-ispammed and safer e-mailing till then...!

Cool Lotus

I found this cool lotus...

Cloaking (Search Engine Optimization)

Search Engine Optimization has been one of my favorite field of interests.
From few months, I found that some websites are able to manage to appear at the top in the result-set from Google search, though the content was not up to the mark. Some times the content was really totally irrelevant or contained ads.

I tried to figure out the case with firing search from different browsers and by custom generated GET and POST messages. I was amazed as the content delivered by those sites were different in different cases. This meant that these sites are able to generate different content for search engine bots / spiders ( providing them some good contents) and when the same site is browsed by any user they show a different content mostly ads by detecting the request / user agent http header.

This technique is in use from 1 or 2 years but it has taken a sweep rise from few months back.
This technique is really deceiving the search engines.
read about it more here at Wiki.

I will share some URLs making use of this technique in days to come.
Till then happy surfing...!

IP delivery

IP delivery is a technique in which web application delivers custom content based on the IP address of the website visitor ( based on the locale and languages etc.)

In years to come, I think IP delivery will be a required add on for any business website.

I watched a nice introductory video here at youtube.

I m lazy!

Yes, I am lazy. Though I read and think a lot but I find less time to publish or share. But I think I should share. From now, I will manage time to publish and write here constantly...