Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4583552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:13:51+00:00 2026-05-21T21:13:51+00:00

First of all, this is not a question about how to get the user’s

  • 0

First of all, this is not a question about how to get the user’s IP address, as i know how to do that.

Basically, administrators of my website (ASP.NET MVC 3 Web Application) need the ability to block a certain IP address from submitting user content. So i’m storing the “IP Address” against user in our system. Cool.

My question is:

When (e.g at what times, page lifecycle events) should i be checked the user’s current IP address and saving to the database?

At the moment, i’m thinking of using session. That is, when i first create the session (e.g Session_OnStart()), grab the users IP address and stick it in the session. Then when the session ends (e.g Session_OnEnd()), i see if the IP address in session is different to that of the database. If it is, update the DB.

At the moment we’re using InProc, but there’s a good chance we’ll go to StateServer later on – and MSDN states Session_OnEnd is only available to InProc. So that might be a problem.

Any thoughts/alternatives to this approach?

EDIT

So i tried using Session_OnStart() to try and do the following thing:

If user is authenticated, get their IP address, get their last IP from the database, and if they different, update the database.

But the problem seems to be that Session_OnStart runs before Application_AuthenticateRequest – so it’s never passing the “is authenticated” check.

A good example is if a user logs into my website – using Forms Auth, which sets a cookie with an expiration date of a week (for example).

Then they come back a few days later – the Session_OnStart is fired – but they’re not authenticated yet. Even though the cookie is present – it hasn’t been processed into the http context yet.

So the Session_OnStart looks like a no go – any other ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:13:51+00:00Added an answer on May 21, 2026 at 9:13 pm

    Since it’s asp.net MVC and you want it to run against all request, I’d consider looking at using a global action filter like the one described here http://weblogs.asp.net/gunnarpeipman/archive/2010/08/15/asp-net-mvc-3-global-action-filters.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is beyond both making sense and my control. That being said here is
I've found several jQuery syntaxes for nullifying the enter on a form. First one:
I was reading JavaScript: The Good Parts and the author mentions that JavaScript is
After having read Ian Boyd 's constructor series questions ( 1 , 2 ,
Let say I have the following desire, to simplify the IConvertible's to allow me
I am attempting to pull some information from my tnsnames file using regex. I
I'm trying to build a C++ extension for python using swig. I've followed the
I am using a 3rd-party rotator object, which is providing a smooth, random rotation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.