Would like to set Session Timeout?

Challenge:

Before so many months back i have been assigned for a task where we need to set a session timeout for our whole application. Some enthu guys will tell it is 2 mins. job just go in web.config and do the configuration and it’s done. But let me tell you it’s not that much easy :(. Because there are two things which affects on session timeout Forms Authentication Timeout and Session Timeout
Forms Authentication Timeout Configuration
[sourcecode language=”xml”]
<system.web>
<authentication mode="Forms">
<forms timeout="50000000"/>
</authentication>
</system.web>
[/sourcecode]
Session Timeout Configuration
[sourcecode language=”xml”]
<pre><configuration>
<system.web>
<sessionState mode="InProc"
cookieless="true"
timeout="20"/>
</sessionState>
</system.web>
</configuration></pre>
[/sourcecode]

Solution

Unfortunately at tha time i haven’t written blog on it[I’m sorry for that]. But Here is the link where someone else did that already[Thanks to him!]:
http://dotnethitman.spaces.live.com/Blog/cns!E149A8B1E1C25B14!210.entry
http://weblogs.asp.net/scottgu/archive/2005/11/08/430011.aspx
http://aspalliance.com/520_Detecting_ASPNET_Session_Timeouts.all

Good To Know on ASP.NET Application Restarts

You all may heard about ASP.NET Application restart. If no then it’s really good to know. Today i got few good links which i would like to share with you guys as well:
http://fuchangmiao.blogspot.com/2007/11/aspnet-application-restarts.html
http://blogs.msdn.com/b/johan/archive/2007/05/16/common-reasons-why-your-application-pool-may-unexpectedly-recycle.aspx
http://blogs.msdn.com/b/johan/archive/2008/02/18/monitoring-application-pool-and-application-restarts.aspx
Hope this articles clear all your questions on ASP.NET application restart. If not feel free to drop a comment here.

Generic List Sorting

Generic List has powerful sorting method which too less .Netters are aware of. Today, I would like to show it’s power to you guys!
Here we go..
Suppose, you have a Class called Employee and created collection of employees using Generic List as shown below:
[sourcecode language=”csharp”]
public class Employee
{
public int EmployeeID { get; set; }
public string EmployeeName { get; set; }
public Employee(int employeeId, string employeeName)
{
EmployeeID = employeeId;
EmployeeName = employeeName;
}
public override string ToString()
{
return EmployeeID + " :- " + EmployeeName;
}
}
List<Employee> employeeList = new List<Employee>();
employeeList.Add(new Employee(2, "Sachin T"));
employeeList.Add(new Employee(1, "Anil K"));
[/sourcecode]
Now, if you need to sort your employees collection by EmployeeID how will you do it? – I know i know you will write your logic and do so many things..But hold on how it will be if we can do it in just one line? sounds cool na? Here you go:
[sourcecode language=”csharp”]
Console.WriteLine(">>>>>>>>>>Before Sorting<<<<<<<<<<");
foreach (Employee employee in employeeList)
{
Console.WriteLine(employee.ToString());
}
// Sorting – Anonymous method
employeeList.Sort(delegate(Employee employee1, Employee employee2)
{ return employee1.EmployeeID.CompareTo(employee2.EmployeeID); });
Console.WriteLine(">>>>>>>>>>After Sorting<<<<<<<<<<");
foreach (Employee employee in employeeList)
{
Console.WriteLine(employee.ToString());
}
/* Output
>>>>>>>>>>Before Sorting<<<<<<<<<<
2 :- Sachin T
1 :- Anil K
>>>>>>>>>>After Sorting<<<<<<<<<<
1 :- Anil K
2 :- Sachin T
Press any key to continue . . .
*/
[/sourcecode]

Links

http://weblogs.asp.net/dwahlin/archive/2007/04/23/The-Power-of-Anonymous-Methods-in-C_2300_.aspx

Embed Almost any Document on Your Website

Challenge:

one of my friend asked me that how can i embed any document on a webpage? gotcha? Nope? okay let me elaborate functionality in a brief.

1. User can post/upload articles on portal in any format. e.g. .PPT,.PPTX,.DOC,.XLS,.XLSX, PDF.

2. Once uploaded after that user can preview his/her uploaded articles in read only format and in same format on Webpage only. No download required.

This is the big challenge! After searching a bit we found a good site and implemented it. I know you guys are eager to know. how? Okay here you go..

Solution:

There is a nice site called http://embedit.in which supports all our requirements – really great stuff by site developers!

It supports embedding document using three ways:

1. Uploading document manually :- Visit http://embedit.in/ and upload your document.

2. using embedit API :- Visit http://embedit.in/api and you can do all operations programmatically. Wow!! And you can sign in using any of the below option. No new form you need to fill up 🙂

image

3. SiteWide :-  Use Sitewide to automatically convert all the links to documents in your website to embeds. You just need to put Javascript reference in your HTML content and rest will be managed by Embedit guys! isn’t is great? So, hurry visit : http://embedit.in/sitewide and have fun!

Our Main Hero is SiteWide – which helped us in fulfilling our requirement.

I know you are eager to see it in action before using it.here you go..

image

image

Looks great na? would like to see within your browser? see this example page : http://embedit.in/sitewide/example

Thanks to my friend for throwing this challenge to me and thanks to Google for searching out embedit.in for me and thanks to embedit.in for developing such a nice functionality!

Happy embedding! 🙂

Webliography

http://go4webapps.com/2010/04/29/embedit-in-embed-any-document-file-or-webpage-in-your-blog-profile-or-website/

http://www.blogsolute.com/embed-documents-word-ppt-pdf-psd-xls/2838/