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

  • SEARCH
  • Home
  • 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 7057285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:58:03+00:00 2026-05-28T03:58:03+00:00

I have just started developing a full-web application by using the ASP .NET MVC

  • 0

I have just started developing a full-web application by using the ASP .NET MVC 3 framework.
I am a MVC 3 beginner developper.


I need a way to implement the following logic :

When my application receives an HTTP request from a browser I want to check if a session is valid with this browser.

If not, I want to execute the Index action method of my Connection controller.
The Index action method returns an HTML5 page to the browser which lets the user authentificates himself to the application.

If a session is valid then I want to check if the IdUtilSession and IdSocSession session variables are stored.
If both session variables are not stored then I want to execute the Index action method of my Connection controller.


I read some MSDN documentation about managing session variables.
I think I am able to manage session variables in my application.

I want to know the event I have to handle – “When my application receives an HTTP request”.
I read the following MSDN documentation page on the ASP .NET application life cycle : http://msdn.microsoft.com/en-us/library/ms178473.aspx
A sequence of events are triggered during the request processing from
Do I need to handle one of these events in my Global.asax file ?

Thanks in advance for your future help

  • 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-28T03:58:04+00:00Added an answer on May 28, 2026 at 3:58 am

    A more MVCish way to achieve this is to write a custom authorize attribute (instead of relying on events which are more commonly used in classic ASP.NET rather than ASP.NET MVC):

    public class MyAuthorizeAttribute : AuthorizeAttribute
    {
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            var authorized = base.AuthorizeCore(httpContext);
            if (!authorized)
            {
                return false;
            }
    
            var session = httpContext.Session;
            return session["IdUtilSession"] != null &&
                   session["IdSocSession "] != null;
        }
    }
    

    and then instead of using the default [Authorize] attribute use your custom [MyAuthorize] attribute.

    As far as the I want to execute the Index action method of my Connection controller part is concerned, you could set the loginUrl attribute in the <forms> tag in your web.config to point to the proper url.

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

Sidebar

Related Questions

At work we have just started developing in C#.NET using VS2008 and we need
I just started developing a web application using struts 1.3.10 tiles framework. There is
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
Intro I'm developing a project with MVC.Net. I have just started a default website
I have just started developing using Youtube API and stuck in very beginning. I
I've just recently started developing a site for iPhone using jQTouch, and have the
I have been developing iPhone application and just started adding CoreData for persistence. However
I have just started developing for Symbian. I am currently using Nokia Qt. I
I have just completed developing my web application. I was trying to deploy it
I have just started with wordpress and want to start developing my own themes.

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.