:::: MENU ::::

Thursday, April 28, 2011

You can create an Automatic Logout user control by doing the following.

1. Create an automatic logout user control.
2. Add 1 RadAjaxPanel, 2 RadAjaxTimers (within the Panel), and 1 RadWindowManager.  Your ASPX will look something like this...

1

<radA:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="1px" Width="1px">  

2

      <radA:RadAjaxTimer ID="RadAjaxTimer1" runat="server" AutoStart="False" /> 

3

      <radA:RadAjaxTimer ID="RadAjaxTimer2" runat="server" AutoStart="False" /> 

4

</radA:RadAjaxPanel> 

5

<radW:RadWindowManager ID="TimeoutWarningPopup" runat="server">  

6

</radW:RadWindowManager> 


3. Create a timeout message ASPX page.  This page will display 10 seconds before the user is logged out.  Mine says, "You will be logged out in 10 seconds."
4. In the user control code behind add the following code...

Imports Telerik.WebControls  

 

Partial Class includes_uc_telerik_ucAjaxTimer  

    Inherits System.Web.UI.UserControl

#Region "-- Members --"  

    Private m_blnTickEvent As Boolean = False

#End Region  

 

#Region "-- Properties --" 

    Public Property TickEvent() As Boolean 

        Get 

            Return m_blnTickEvent  

        End Get 

        Set(ByVal Value As Boolean)  

            m_blnTickEvent = Value  

        End Set 

    End Property

#End Region  

 

    Protected Sub RadAjaxTimer1_Tick(ByVal sender As ObjectByVal e As Telerik.WebControls.TickEventArgs) Handles RadAjaxTimer1.Tick  

        RadAjaxPanel1.ResponseScripts.Add("radopen'../../web/telerik/ajax_timer_msg.aspx','RadWindow1');")  

        RadAjaxTimer1.Stop()  

        Me.TickEvent = True 

    End Sub 

 

    Protected Sub RadAjaxTimer2_Tick(ByVal sender As ObjectByVal e As Telerik.WebControls.TickEventArgs) Handles RadAjaxTimer2.Tick  

        Response.Redirect("../../web/security/login.aspx")  

    End Sub 

 

    Protected Sub Page_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.PreRender  

        If Me.TickEvent = False Then 

           RadAjaxTimer1.Interval = 3600000 '1 hour  

           RadAjaxTimer1.Start()  

 

           RadAjaxTimer2.Interval = 3600000 + 12000 '1 hour + 12 seconds  

           RadAjaxTimer2.Start()  

        End If 

    End Sub 

      

End Class 

 


5. Place the user control inside a master page or any pages that needs a logout timer.

Okay...  Let's break this down.

When the master page loads the user control Page_PreRender event will fire during the order of operations.  The Page_PreRender will start both timers only if the TickEvent property is False (default).  The property is needed becuase the Page_PreRender will fire after the RadAjaxTimer1_Tick is fired - we don't want to restart the timer on this event.

After Timer1 interval is reached the RadAjaxTimer1_Tick event is fired.  This event opens the message window stating you will be logged out, and sets the TickEvent property (see above for the reason why).  

If the user does nothing...  RadAjaxTimer2_Tick event fires and the user is sent to the login screen.

If the user causes a postback (clicks a link, button, etc.) the timers start again and keep the user logged in.

I have set my SessionTimeout to 61 minutes.  The session also resets when the user causes a postback so I think I'm safe in both cases.

So...  If a user walk away from the machine for an hour or has an extended period of inactivity...  They get logged out.

I hope this helps someone that might need the same functionality.

Wednesday, April 27, 2011

A lot of people keep asking about a good list of .net libraries. Hence, we are building this list to save your time and to spread the knowledge.

Some of these libraries will definitely help us developing better solutions. We will do our best to keep updating this list, hope you find this list useful, here we go.

Ajax

  • Ajax Control Toolkit - Microsoft
  • AJAXNet Pro
  • ASP.NET MVC Project Awesome - a rich set of helpers (controls) that you can use to build highly responsive and interactive Ajax-enabled Web applications. These helpers include Autocomplete, AjaxDropdown, Lookup, Confirm Dialog, Popup Form and Pager. Thanks Omu (April 20, 2011)

Build Tools

  • Prebuild - Generate project files for all VS version, including major IDE's and tools like SharpDevelop, MonoDevelop, NAnt and Autotools
  • Genuilder - Precompiler which lets you transform your source code during the build. Thanks Harry McIntyre (April 13, 2011)

Charting/Graphics

Collections/Generics

  • PowerCollections - is a library that provides generic collection classes that are not available in the .NET framework. Some of the collections included are the Deque, MultiDictionary, Bag, OrderedBag, OrderedDictionary, Set, OrderedSet, and OrderedMultiDictionary. Thanks Adam Ralph (April 20, 2011)

Compression

Controls

  • Krypton - Free winform controls. Link fixed (April 14, 2011)
  • Source Grid - A Grid control
  • DevExpress - Over 60 Free Controls from DevExpress. Thanks Florian Standhartinger (April 20, 2011)
  • ObjectListView - is a C# wrapper around a .NET ListView. It makes the ListView much easier to use and provides some neat extra functionality. Thanks Florian Standhartinger (April 20, 2011)

Data Mapper

Dependency Injection/Inversion of Control

Design by Contract

IDE

  • SharpDevelop - is a free IDE for C#, VB.NET and Boo projects. Thanks Florian Standhartinger (April 20, 2011).

Logging

ORM

PDF Creators/Generators

Automated Web Testing

Misc Testing/Qualitysupport/Behavoir Driven Development (BDD)

URL Rewriting

MS Word/Excel Documents Manipulation

  • DocX to create, read, manipulate formatted word documents. Easy syntax, working nicely, actively developed. No Microsoft Office necessary.
  • Excel XML Writer allows creation of .XLS (Excel) files. No Microsoft Office necessary. Been a while since it has been updated. It also provides code generator to create code from already created XLS file (saved as xml). Haven't tested this but looks very promising. Too bad author is long time gone.
  • Excel Reader allows creation/reading of .XLS (Excel) files. No Microsoft Office necessary. Been a while since it has been updated.
  • Excel Package allows creation/reading of .XLSX (Excel 2007) files. No Microsoft Office necessary. Author is gone so it's out of date.
  • EPPlus is based on Excel Package and allows creation/reading of .XLSX (Excel 2007). It is actually the most advanced even comparing to NPOI.
  • NPOI is the .NET version of POI Java project at http://poi.apache.org/. POI is an open source project which can help you read/write xls, doc, ppt files.
  • sharp2word - a Word 2003 XML Documents Generator from C# code without any components or libraries. Thanks dublicator (April 20, 2011)
  • ClosedXML - an actively developed library for generating OpenXML Excel files. Thanks Joseph Robichaud (April 26, 2011)

Serialization

  • sharpserializer - xml/binary serializer for wpf, asp.net and silverlight
  • Protobuf.NET - fastest serialization port protobuf format into .NET platform. Thanks slava pocheptsov (April 26, 2011)

Silverlight

Social Media

  • LinqToTwitter - Linq-based wrapper for all Twitter API functionality in C#
  • Facebook C# SDK - A toolkit for creating facebook applications / integrating websites with Facebook using the new Graph API or the old rest API.

Package managers for external libraries

  • NuGet (formerly known as NuPack) - Microsoft (developer-focused package management system for the .NET platform intent on simplifying the process of incorporating third party libraries into a .NET application during development)
  • OpenWrap - Sebastien Lambla - Open Source Dependency Manager for .net applications

Unit Testing/Mocking

Validation

Threading

  • Smart Thread Pool - Thread Pool management library
  • Retlang - a high performance C# threading library. Thanks MarcBot (April 13, 2011)
  • bbv.Common - an open source library of software components that makes building multi-threaded, event-based and loosely coupled systems easy. Thanks Urs Enzler (April 14, 2011)
  • PowerThreading - a llibrary (DLL) containing many classes to help with threading and asynchronous programming. Thanks Adam Ralph (April 20, 2011)

Unclassified

  • CSLA Framework - Business Objects Framework
  • AForge.net - AI, computer vision, genetic algorithms, machine learning
  • Prism - Composit UI application block for WPF, Silverlight and WP7 - Microsoft patterns & practices
  • Enterprise Library 5.0 - Logging, Exception Management, Caching, Cryptography, Data Access, Validation, Security, Policy Injection - Microsoft patterns & practices
  • File helpers library
  • C5 Collections - Collections for .NET
  • Quartz.NET - Enterprise Job Scheduler for .NET Platform
  • MiscUtil - Utilities by Jon Skeet
  • Noda Time - DateTime replacement (idomatic port of Joda Time from Java)
  • Lucene.net - Text indexing and searching
  • Json.NET - Linq over JSON
  • Flee - expression evaluator
  • PostSharp - AOP
  • IKVM - brings the extensive world of Java libraries to .NET.
  • C# Webserver - Embeddable webserver
  • Long Path - Microsoft
  • .NET Engines for the GOLD Parsing System
  • NCQRS - library for event-driven architectures (CQRS).
  • Reactive Extensions for .NET - a library for composing asynchronous and event-based programs using observable collections. Thanks steve (April 14, 2011)
  • Mono.GameMath - a project to develop a highly-performant math library for games, based on XNA APIs. Thanks Alex Rønne Petersen (April 14, 2011)
  • SLSharp - a runtime IL-to-GLSL translation engine, allowing people to write GLSL shaders as C# code. Thanks Alex Rønne Petersen (April 14, 2011)
  • InfusionSoftDotNet - a dll to ease the pain for .Net developers to access the InfusionSoft API. Thanks Michael Gibbs (April 20, 2011)
  • re-mix - provides mixins for C# and Visual Basic .NET. Thanks Stefan Papp (April 20, 2011)
  • Mono.Cecil - a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. It has full support for generics, and support some debugging symbol format. Thanks Florian Standhartinger (April 20, 2011)

more