Thursday, April 18, 2013

How many ways to redirect URL in Javascript?

1. window.location.href=”login.htm";
2. window.navigate(”login.htm”);
3. self.location=”login.htm”;

Any other way?

Wednesday, April 17, 2013

How to disable browser back button in asp.net?

Should make ASP.NET page cache expired instead of disable browser back button

Page.Response.Cache.SetCacheability(HttpCacheability.NoCache)

Tuesday, April 16, 2013

How to get active users in last 10 minutes in ASP.NET membership database?

select top 300 * from dbo.aspnet_Users u
where u.LastActivityDate > DATEADD(minute, -10, GETUTCDATE())
order by u.LastActivityDate desc

Monday, April 15, 2013

How to fix problem: missing files when publish a website in Visual Studio for ASP.NET?

In Visual Studiio, Content files need to be marked for publishing
Right click on the file missed -> Properties -> Build Action set to Content.

Thursday, April 11, 2013

How to find common items in two set of items in C#?

            var list1 = new List() { 1, 3, 4, 5 };
            var list2 = new List() { 2, 3, 4, 5 };
            var commonItems = list1.Intersect(list2);