Archive for ASP.NET

27 Jun 2011

Free Video Training on ASP.NET MVC

No Comments ASP.NET

If you are looking for free online tutorials to learn ASP.NET MVC 3 basics then you should check out ASP.NET MVC site. Microsoft has made arrangements with Pluralsight to provide many on-demand videos free of charge.

Link: ASP.NET MVC

07 Nov 2010

Stop IE flickering between pages

No Comments ASP.NET, Web Development

If you hate that slight flicker in IE browser between page transitions then you will find this snippet useful.

When user navigate from one page to another in IE, there is slight “white out” before this transition. Whereas in Firefox and other browsers this page transition is very smooth. IE browser will show blank page for very short duration before showing content of next page. User experience this effect more like flicker on the browser. If your web application has more post backs then it become more annoying to users.

To reduce this flicker in IE, simple add below META tags in HEAD section of your page.

<META http-equiv="Page-Enter" content="blendTrans(Duration=0.05)" />
<META http-equiv="Page-Exit" content="blendTrans(Duration=0.05)" />

By reducing the duration between fading previous content and revealing new content, user experience relatively smooth transition between pages.

This snippet has only impact on IE and not on other browsers.

15 May 2009

Implementing Auto-Logout functionality

1 Comment ASP.NET, Web Development

Here is small javascript snippet you will find useful for your web application. It will automatically logout user after specific time of inactivity.

<script type="text/javascript">
var timer;
var wait=10;
document.onkeypress=resetTimer;
document.onmousemove=resetTimer;
function resetTimer()
{
    clearTimeout(timer);
    timer=setTimeout("logout()", 60000*wait);
}
 
function logout()
{
    window.location.href='Logout.aspx';
}    
</script>

Code is self explanatory. We are using setTimeout method which will call a function (logout function in above case) after specified delay in milliseconds. With that, we also resetting that again and again for every user movement on page.

You just need to drop this code in all pages (except login and unsecured pages) of your application. Master page is good place instead for easy maintenance.

Before login off user from application, you may also like to alert user first. So let’s extend above code further. This gonna be bit tricky as we cannot use simple javascript alert to show this message. Instead we will create a DIV layer in the page and use it for showing alert message. Any user interaction will hide this alert message. After specific time of inactivity, user will navigate to Logout.aspx page where you can provide actual implementation to logout user and clear all session objects.

Here is modified code:

<html>
<head runat="server">
<title>Default Page</title>
<script type="text/javascript">
var timer1, timer2;
document.onkeypress=resetTimer;
document.onmousemove=resetTimer;
function resetTimer()
{
    document.getElementById('timeoutPopup').style.display='none';
    clearTimeout(timer1);
    clearTimeout(timer2);
 
    // waiting time in minutes
    var wait=10;
 
    // alert user one minute before
    timer1=setTimeout("alertUser()", (60000*wait)-1);
 
    // logout user
    timer2=setTimeout("logout()", 60000*wait);
}
 
function alertUser()
{
    document.getElementById('timeoutPopup').style.display='block';
}
 
function logout()
{
    window.location.href='Logout.aspx';
}    
</script>
<style type="text/css">
#timeoutPopup {
    display:none; 
    position:absolute; 
    top:0; right:0; bottom:0; left:0;
    width:30%;
    height:30%;
    margin:auto;
    padding:4px;
    border:solid 1px #999999; 
    background-color:#dddddd;
    text-align:center;
}
</style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="timeoutPopup">
        Your session is about to expire if there is no additional 
        activity.
    </div>
    </form>
</body>
</html>
18 Mar 2007

DOTENET: Favlet To Post Links

No Comments ASP.NET, C#, Web 2.0

Here is the small Favlets which can assist you to post links at DOTENET portal. Simply drag below hyperlink to toolbar of your browser. It will create a bookmark link at toolbar clicking on which can post current page to DOTENET portal.

Favlets: DOTENET: Submit
(drag this link to browser’s toolbar)

Here are small tutorials on installing Favlets in your browser:
How to use favlets
Bookmarklets – Browser Power
About Bookmarklets

How to use this Favlet? It’s just a matter of click now. If you find any article, post or blog useful simply click on the favlet at toolbar, this favlet will then navigate you to the submit page with URL, Title field already entered. Now you only have to provide description and tags. To further reduce navigating between source URL and DOTENET, you can follow these steps:

1. After finding any useful link, select abstract summary of article or post. If you want to provide your own description, skip this step.
2. Click on the “DOTENET: Submit” favlet. You will be redirect to submit page.
3. Provide tags in submit page. And you are done!

Please do let me know if you are facing any issue to submit post.

UPDATE: I have modified this favlet to send selected text of source article/post to DOTENET submit page. You now just have to select text and click on this favlet.

18 Mar 2007

Announcement: DOTENET

8 Comments ASP.NET, Web 2.0

Its give me immense pleasure to announcement .NET portal – DOTENET (URL: www.dotenet.com). It’s “Digg” style web application dedicated to .NET and relative technologies. This portal will serve as central hub to share articles, tutorials, blog post etc.

When I was planning to create this portal two months back, I was sure that first release of this project will have minimum “must to have” features and later I will add features which are “good to have”. And that’s why you will notice many blank pages on this portal. These blank pages are place-holder for features which I will add in coming weeks (depending upon available bandwidth).

The desired goal of creating a community portal cannot be achieved without your active participation. Please register yourself to this portal and share any article or post which you think useful to .NET community. If you find any existing link useful in DOTNET portal, please vote for that link so that link can be push to popular segment.

As you continue participating in this portal, please keep in mind that this community portal needs your feedback to remain alive. Please provide your feedback/opinion/suggestion to this post

URL: Home Page
URL: Registration Page