Question

I have an admin page which lists all active ASP.NET membership users. That page also lists users that are currently authenticated & online.

Is it possible to determine what page/url these users are currently browsing?

Is that possible Using the native membership provider?

If not, what would be the simplest way of reporting that information without having to store it in a DB or somewhere else.

Était-ce utile?

La solution

ASP.NET Membership does not provide a native way to do what you're asking (track the last page that an active user visited).

If not, what would be the simplest way of reporting that information without having to store it in a DB or somewhere else.

I can't think of any way to do this outside of storing the page name in a database each time an authenticated user visits a page. That's not to say that there isn't a way, but it seems like you would need to store that somewhere in order for it to be available to your application.

You could (ab)use the user profile system that's built into ASP.NET to store this information. You could make a profile attribute named "LastPageVisited." Then, on page load, identify which user is loading the page, and update their LastPageVisited profile attribute to the name of the current page.

You would just need to add this type of thing to your web.config:

<profile>
  <properties>
    <add name="LastPageVisited" />
  </properties>
</profile>

And then this type of code to whatever page load process you have in place:

Profile.LastPageVisited = "your page name";

Once you're storing this information in user profiles, you will need to use the static methods in the SqlProfileProvider class to look up and display that information in your admin screen.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top