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 7031339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:47:26+00:00 2026-05-28T00:47:26+00:00

I have an MVC3 web app which is effectively ‘bolted on’ to a classic

  • 0

I have an MVC3 web app which is effectively ‘bolted on’ to a classic ASP website (i.e old pages are classic asp, new pages are ASP.Net MVC).
The site requires the user to log in, so to protect the new MVC pages, I check for a cookie and use the id to retrieve session data from the database which has been created by the classic ASP login page.

Because the user can switch between old & new pages, amd I’m not sharing session data across the 2 apps, I check for the cookie & retrieve data every request in my action method called LogIn:

public PartialViewResult LogIn()
        {
            var cookieId = DecodeCookieId(System.Web.HttpContext.Current.Request.Cookies["cookiename"].Value);

            LoggedInViewModel viewModel = new LoggedInViewModel
            {
                Session = sessionRepository.Sessions.FirstOrDefault(s => s.GGAPSession_ID == cookieId)
            };
            return PartialView(viewModel);
        }

This passes data to a ViewModel which displays the logged in username at the top of every MVC page, which is why I thought it would be a good place to do the checking.

The problem occurs when I try modify LogIn() to check for the cookie & redirect if not found:

public ActionResult LogIn()
{
   if (System.Web.HttpContext.Current.Request.Cookies["cookiename"] != null)
  {
     //  same method contents as above
  }
  else
  {
    return Redirect("http://localhost/index.asp");
  }
}

I get a ‘Child actions are not allowed to perform redirect actions’ which I understand, but how do I get round this? Should I be doing the cookie checking elsewhere? And where should I be doing the session management?

  • 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-28T00:47:26+00:00Added an answer on May 28, 2026 at 12:47 am

    I think you can use a global action filter in you mvc site to do this.it’s a general principal stated in book 《ASP.NET MVC in Action》. Do your retrieve in

    OnActionExecuting
    

    if cookie exists. otherwise,

    filterContext.Result = new RedirectResult("http://localhost/index.asp")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Web Service for my ASP.NET MVC 3 app which creates a
I have an MVC3 web app to which I want to start using whole
I have an MVC3 C#.Net web app. I have a requirement to display a
I have an MVC3 C# .Net web app. The app works fine when launching
I have a MVC3 project for running on the iPad in the web-app mode.
I have a C# .Net web app using MVC3. I am using Aspose to
This is about asp.net mvc3 web application. We have used Object cache to store
I have created a web application using ASP.NET MVC3 in Visual studio (no SQL
I have an MVC3 C#.Net web app. I am needing to zip a subset
I have mvc3 web app. inside that I have one Enquiry form once I

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.