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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:10:27+00:00 2026-05-29T09:10:27+00:00

I have a new MVC application which integrates into a larger pre-existing intranet site.

  • 0

I have a new MVC application which integrates into a larger pre-existing intranet site.

In production, authentication details will be passed from the existing intranet site. But in development I need a local forms login control to create the authentication.

This means I need a way to hide any of the local login pages when the solution is deployed to production server. I was trying to use Debugger.IsAttached to redirect away from any login page

public class AccountController : Controller
{
    public ActionResult LogOn()
    {
        if (!System.Diagnostics.Debugger.IsAttached)
            RedirectToAction("NotFound");

        return View();
    }
}

It turns out this doesn’t work. For some reason which is a mystery to me, the login page is still served when navigating to /Account/LogOn.

Can I fix this? Is there a better way?

  • 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-29T09:10:28+00:00Added an answer on May 29, 2026 at 9:10 am

    Just out of curiousity, are you aware of the “Authorize” attribute?

    http://msdn.microsoft.com/en-us/library/system.web.mvc.authorizeattribute.aspx

    You mention that your application is part of a larger application that I assume deals with the security (authentication), right ?

    If so, in development, you could have a different/specific web.config for your needs.

    <authentication mode="Forms">  
      <forms loginUrl="~/MyDevelopment/LogIn"/> //Just for dev
    </authentication>  
    

    Also,

    Instead of the Debugger.IsAttached, I suggest you use the compiler’s directive

    #if !DEBUG
        RedirectToAction("NotFound");
    #endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC 4 application which uses the new ASP.NET Web API.
I have created a new ActionFilter for an ASP.NET MVC application that I'm creating.
I have a new solution that is an ASP.NET MVC 2.0 application. I have
I am new to Spring MVC . I have a web application. I have
I have an application (ASP.NET MVC) that uses a Next New method to get
I have an ASP MVC application which uses some silverlight applications in the View.
I have an ASP.NET MVC 2 application which in part allows a user to
I have an ASP.NET MVC 2 application in which I am creating a custom
I have an mvc application in which I want to make the texbox readable,i
I have a Library application which is already implemented in spring MVC. I need

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.