.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Getting Users who logged on in last month

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
Hi all, Using Sql Server 2005. Is it possible to retrieve from Sql Server the name and times of all users who logged into the server in the last month? Regards Melt

View Complete Post

More Related Resource Links

Users getting logged out because HttpContext.Current is null


We've  been trying to fix this one for a couple years, and I'm just out of ideas, so any help is really appreciated!

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users.  Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies.  In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. 

Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage session

As for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was.  This seems to work well for us.  It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.

What's happening is that certain users are being logged out after just a few minutes.  We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out.  We do not know why the HttpContext.Current is null, and I underst

Code to get how many users are logged in to the sharepoint site

How to get the users of my sharepoint who are online.....

Thanx in advance,


How to allow anyone to see the data, but only logged in users to edit it?

Hello,Don't know if this is documented anywhere, but I haven't found it yet.Let's say I want to allow anyone visiting a site to see the data. That's fairly easy as DD does this for you.However, I don't want just anyone to be able to edit the data. I only want selected people to be able to do that. I presume DD works with forms authentication as I've seen it mentioned, but I ahven't seen how to do it yet. Anyone able to give some pointers?Assuming that I've got authentication, how do I make it so that the public doesn't see an edit or delete link when viewing data?Thanks for any help

FBA users (ldap provider) don't have any user profile info when logged in.... what am I doing wrong

Sharepoint 2010, Claims authentication, FBA using ldap membership provider and role provider against Active Directory.  User profiles all imported just fine -- used the LDAP FBA provider hitting Active Directory to do so too.  whenever an FBA user logs in, it doesn't seem like sharepoint is picking up any user attributes.  targeted audiences don't work and MY SETTINGS is blank other than account and name.  If the same user logs in but through Active Directory, everything works just fine... targeted audiences, etc. Am I doing something wrong or can I not use the LDAP provider to authenticate to AD and also use the user profiles from Sharepoint?  GRRRRR.  All this to get around the Windows Authentication popup so I can customize a better looking logon experience.  Help?

Accessing Logged In Users Details from MasterPage

Hi I have designed a navigation structure that is customisable from within my application and linked to the users role. So I can restrict what menu items a user gets based on their role. I have managed to do this quite well using SQL Tables and an ASP.Net Menu. I can get it to only show the menuitems that are marked active and I have created an Stored procedure to get the menu items for a particular role. Where I am struggling is getting the Logged On Users Roleid to pass it to the Stored Procedure. I can get it using a regular aspx page but my menu is on my masterpage and I do not want to have to code it in each and every page. I even tried to do it with a user-control but same happens.  It seems that the User class is just not available when in a masterpage. Anyone know how I can pass the roleid from a Class or something or from the page to the masterpage? Please Help.   Ronnie 

How to find out how many users logged onto a sharepoint hosted site?


We have a sharepoint hosted site that is accessible to users externally. 

Sometimes whenever we need to  release some updates, we would like to do it when there is no user browsing the site.

Are there are any tools available? If not, can we write any scripts or code?

Please suggest.

How to ensure that all users are logged off the sql database and that they can't access when the SQ


We are trying to restore a SQL Server 2005 (all the databases). We have failed with the restore for a couple of times and the vendor says that we have to ensure that all database users are logged off the database. A restore will fail if other users try to use the database while the restore operation is in

How could this be acomplished. There is no way that we can control if any user or app access the server while we are restoring.

The problem is that when when we are restoring the databases if someone access any of them while the restore is taking place the process fails.

The question is how should the restore be performed? Is there any way to change the state of the database so that the databases can be restored?

Any thoughts?

securing URL for logged in users


 Hello there ...

I need something to secure my PDF files link ...

i have a page like http......../folder/userName.pdf


i need to to encrypt the file name ( i put it "login userName" ) ...


how do i let logged in users download their pdf files without knowing the URL above , for security reasons only ...

Thank you ...

Assuming identity of other logged in users in web application using Forms Authentication and Singlet



I have a web application with a login form. A user enters a user name and password. If they exist in the database the user is authenticated using these two lines:

FormsAuthentication.SetAuthCookie(userName, false);
FormsAuthentication.RedirectFromLoginPage(userName, false);

The problem is that when a user logs in at first he is logged in as himself. When navigating on the web application for a while the user assumes the identity of another logged in user. This happens all the time.

In my web.config the authentication mode looks like this:

<authentication mode="Forms">
  <forms loginUrl="LogOn.aspx" name=".ASPXFORMSAUTH">
  <deny users="?" />

The site does not use ASP.NET session variables. Instead each page initializes a Singleton class, which stores itself in a static class variable, always accessing the users data already read from the database.

The Singleton implementation is:

static readonly WebSession instance = new WebSession();


public static WebSession GetSingletonInstance
  get { return instance; }

Could the problem with assuming anoth

hide or show CheckBoxList depending on Users logged in profile??



New users can register on my site by completing a basic form that has the create user

wizard control with some additional information i am collecting using a CheckBox List.


They can then log in to the site and and view "MypProfilePage.aspx" where I

display the information with the CheckBoxList boxes already ticked based

their selections which they can update.


My problem is I have two levels of User and each one has a different registration form.

Registration Form A

Has 20 Items in the CheckBox List


Registration Form B

Has 10 items in the CheckBox List


On the Profile Page, I just want to show the  CheckBox which is relevant to the Registration form A or B and with selections by the  registered user.

So therefore the User who registered on B will not be able to see the selections checkbox list for A.


I hope this makes sense and appreciate any solutiosn in c sharp ideally.




--HOW TO -- Only allow logged in users to view Default.aspx, and About.aspx


Hello there guys,

First of all, thank you for the attention.

I am having some trouble, I am very new to asp.net, and the last problem I had, I spent about 59 hours trying to solve, Now I have a new one !

:D well, I guess this is part of the learning process...

Well, in Visual Studio 2010, I clicked New Website. @ C# language, ... The template it gives is pretty nice, it creates a database MDF file, and a login/register setup ready to go !...

You guys can see it live AT CLICK HERE ...

Everything is working, well at least here at the local machine...

There are 2 pages in there, Default.aspX, and About.aspx ... I want to allow ONLY logged in users to view those 2 pages...

I tryed a few things, added my account to a role called ADMIN,

In the web.cong I changed Allow"*" to allow"ADMIN" ... still didn't work..

Also, I was trying to avoid using roles for now, and I was trying to find a way to do this for individual pages in the same directory as well... If possible with out touching the web.config file...

But for now, every way will already help me in any future implementations...

Once again, thank you for your attention..

Thanksssss 10000X

SQL logged users


in our LAN we have a database server and we suspect that one of employees somehow got an access with sa account, is there a way to generate a report from sql that shows login activity history with host machine


MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Enabling Users to Maintain SharePoint Content

When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

Some areas of the site usually contain less-dynamic information. Internal memos and corporate policies are common examples of this information. One option for this information is to post these documents in a document library. Documents in a library are often stored in a few different formats: Word, Acrobat (PDF), or HTML. Each of these formats has its drawbacks.

Enabling Users to Maintain SharePoint Content

When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

Need help redirecting users to personalized page


 Hi, first timer here so be gentle.


I've been able to create a cool little website, it's up and running with users logging in and out, I created roles so my administrative team can see sensitive data that's not available to regular and anonymous users.

Now they would like me to create a page specific to each user.  For instance when user A logs in they are redirected to a page that has information that pertains to user A only (like a list of their benefits/ their remaining vacation time). This page needs to be accessible only to user A. 

I've watched a ton of the videos but have yet to see one that covers this topic, any help would be great!!!





logged in user data


I'm using the defualt membership provider, i created a table and used the gridview on the logged in user page to show his information such as address e-mail phone zip code etc,, how can i do this without writing a code?

I am new to asp.net  i need simple help please?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend