3 quick things to check if your ASP.NET session ends before timeout

Session ending before timeout is an issue faced by many developers who use IIS 6. I have found that in most cases, this is caused when you set the recycling of worker processes using IIS manager.

Check this cool post to understand this better.

Here are 3 quick suggestions to troubleshoot this issue (assuming that you are using In-process mode - ASP.NET session state):

1. Check and see if you have configured recycling of worker processes

2. If you are maintaining cookie enabled sessions, check if the cookie is not getting deleted/modified at the client end.

3. Check to see if IIS/Application Pool is not getting restarted at regular intervals. Your application pool will restart if your global.asax or the web.config/ machine.config changes

Change the Default Cursor on an ASP.net Image Button

How do you change the default cursor when the mouse is hovered over an ASP.NET Image Button? Here’s how to do so in a simple way:

<div> 
<
asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/progress.gif" />
</
div>


C#



protected void Page_Load(object sender, EventArgs e)
{
if (1 == 1)
{
ImageButton1.Style.Add(HtmlTextWriterStyle.Cursor,
"url('3dwno.cur')");
}
}


VB.NET



Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As EventArgs)
If 1 = 1 Then
ImageButton1.Style.Add(HtmlTextWriterStyle.Cursor, _
"url('3dwno.cur')")
End If
End Sub



You can also create CSS in the following way:



<style type="text/css">
.first{
cursor: url('Images.cur');
}

.second{
cursor: url('3dwno.cur');
}
</style>



and change the CSS of the image button in code behind / JavaScript based on the condition.

IIS SEO Toolkit Beta Now Available

IIS Search Engine Optimization (SEO) Toolkit Beta is a free toolkit that helps Web developers, hosting providers, and server administrators by recommending how to make their site and the content more search engine-friendly. With SEO being one of the most sought after ingredient in any online web entity, this free tool comes as a great resource for your SEO activities.

Some features of this toolkit in it’s Beta include:

Site Analysis module – a crawler that examines the site contents, links and other resources and helps you identify and troubleshoot broken links and duplicate content. This module also analyzes the site's content, structure and URLs for keyword analysis and route analysis making it search engine friendly.

Robots Exclusion module – Allows owners to manage the robots.txt file from within the IIS Manager interface and makes use of the Site Analysis report to allows/disallow entries

Sitemaps and Site Indexes module – Allows administrators to manage the sitemap files to help keep search engines updates with your site’s content.

To learn more about this toolkit, check the following links:

http://www.iis.net/extensions/SEOToolkit

http://weblogs.asp.net/scottgu/archive/2009/06/03/iis-search-engine-optimization-toolkit.aspx

http://blogs.iis.net/windowsserver/archive/2009/06/03/download-the-new-iis-seo-toolkit-beta.aspx

http://blogs.msdn.com/carlosag/archive/2009/06/03/iis-search-engine-optimization-toolkit-beta-1.aspx

Google Squared - Search is now Square

Google Squared was launched yesterday, June 03, 2009. Google Squared is a search tool that takes a search category, searches out results from the web and presents them in an organized collection, very similar to a spreadsheet.

As given on the Google site,

Google Squared is a search tool that helps you quickly build a collection of facts from the Web for any topic you specify.

- Facts about your topic are organized as a table of items and attributes (we call them "Squares" for fun).
- Customize these Squares to see just the items and attributes you're interested in.
- See the websites that served as sources for the information in your Square.
- Save and share Squares with others.

You can try out Google Squared over here http://www.google.com/squared with additional info about the product over here

I tried the search term Search Engine and here’s what I got:

image 

Ahemm..Where’s BING or Live Search?

Then I searched for Browsers and was surprised!

image

Where’s Google’s own browser Chrome?

You also have the feature of adding or removing columns, just like you do in a spreadsheet. I clicked on the ‘Add’ button on the right, and here were the additional columns that showed up. You can add your own custom columns as well:

image

You can also sign-in (extreme top right) using your gmail id and save your squares. Once you save your squares, the next time you want to view the squares, check the ‘saved squares’ section as shown below:

image

In my opinion, this tool is cool since it searches the entire web and categorizes information, which can be saved for later use. How well does the tool search? Time will tell as the tool develops!

Go Search your Square!

How to Change the URL of an ASP.NET Hyperlink Control at runtime using jQuery

I recently was solving one of the queries at the forums where the user wanted to change the URL of a Hyperlink control at runtime. This task becomes very simple using jQuery as shown here



<html xmlns="http://www.w3.org/1999/xhtml">


<head runat="server">


<title></title>


<script src="Scripts/jquery-1.2.6.js" type="text/javascript"></script>


<script type="text/javascript">


    $(document).ready(function() {


        $("[id$='HyperLink1']").attr("href", "http://www.devcurry.com");


    });    


</script>


</head>


<body>


<form id="form1" runat="server">


<div>   


    <asp:HyperLink ID="HyperLink1" runat="server"


    NavigateUrl="http://www.dotnetcurry.com">Favorite Site</asp:HyperLink>


</div>


</form>


</body>


</html>




This piece of code changes the url from dotnetcurry.com to devcurry.com

Free SnagIt license key till June 5th 2009

SnagIt is a Screen Capture software from TechSmith. With SnagIt, you can capture your screen, edit and combine those captures and then share and organize them.

SnagIt is offering you a free, legal version of Snagit 7.2.5 through 5 pm (EST) on June 5, 2009. Please note this version is not compatible with Windows Vista. Please register below to receive your software key.

http://www.techsmith.com/Covermount/covermount.asp?ID=8

You can download SnagIt from here.

Microsoft Bing is launched - Ping the Bing

Today Microfot released a powerful search service that gives quick and easy access to knowledge from the Web, thereby enabling you to take important decisions. It's called Bing.

As quoted by Microsoft CEO, Steve Ballmer -
Search engines do a decent job of helping people navigate the Web and find information, but they don’t do a very good job of enabling people to use the information they find. When we set out to build Bing, we grounded ourselves in a deep understanding of how people really want to use the Web. Bing is an important first step forward in our long-term effort to deliver innovations in search that enable people to find information quickly and use the information they’ve found to accomplish tasks and make smart decisions


You can find more details about Bing in the PressPass over here - http://www.microsoft.com/presspass/press/2009/may09/05-28NewSearchPR.mspx?rss_fdn=Press Releases

So go on. Ping the Bing at www.bing.com

How to find all the checked checkboxes in an asp.net gridview

I have seen this question a gazillion times on the forums – Finding checked checkboxes in an ASP.NET GridView. Here’s how to do so. The CheckBox in our example is in a TemplateField as shown below:

<asp:TemplateField>   
<
ItemTemplate >
<
asp:CheckBox id="CheckBox1" runat="server" />
</
ItemTemplate>
</
asp:TemplateField>



In order to find the checked checkboxes on a button click, use this simple code



C#



    protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvr in GridView1.Rows)
{
CheckBox chkBox = (CheckBox)gvr.FindControl("CheckBox1");
if (chkBox != null && chkBox.Checked)
{

}
}
}



VB.NET



Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As EventArgs)
For Each gvr As GridViewRow In GridView1.Rows
Dim chkBox As CheckBox = _
CType(gvr.FindControl("CheckBox1"), CheckBox)
If chkBox IsNot Nothing AndAlso chkBox.Checked Then
' Do Something
End If
Next gvr
End Sub