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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:05:23+00:00 2026-05-22T20:05:23+00:00

I have a shared view called NotAuthorised in the folder ‘Views/Shared’. I want to

  • 0

I have a shared view called NotAuthorised in the folder ‘Views/Shared’. I want to redirect the users to this view when they are not authorised to see the page.

Initially, this view was in a folder called Account. But I moved it into the Shared folder as I am not using the Account anymore. I have deleted the Account folder.

I used the following code to redirect:

public ActionResult NotAuthorised()
{  
   return RedirectToAction("NotAuthorised", "Account");
}

Now that I removed the Account folder, I’m trying to use

public ActionResult NotAuthorised()
{  
   return RedirectToAction("NotAuthorised", "Shared");
}

I am completely wrong by giving the folder name shared in the last line.

Could anyone tell me, what I am doing wrong?

Thank you

  • 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-22T20:05:24+00:00Added an answer on May 22, 2026 at 8:05 pm

    You can’t redirect to a View, only to an Action of a Controller. You have to specify an controller action for your redirect and there you can render your shared view.

    public class AuthorizeController : Controller
    {
        public ActionResult NotAuthorised()
        {  
           return View("NotAuthorised");
        }
    }
    

    and later redirect to this new action from within any other action method:

    return RedirectToAction("NotAuthorised", "Authorize");
    

    But you may not need this additional Controller. You could simply render the shared View

    public ActionResult NotAuthorised()
    {  
       return View("NotAuthorised");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In .net we are not allowed to have shared function/methods in abstract classes and
Over the last few months/years, I have shared a folder or two with numerous
I have two process and a shared memory zone, my workflow is like this.
we have a lot of users running in different shared and solo-owned repositories in
I have a partial view that is shared between two controllers and I'm trying
I have a master page which is shared between about 20 views. In just
I have a shared view in my _Layout.cshtml for my header named _Header.cshtml. I
I have a controller 'QUnitController', then I have a folder in my Views folder
So, if I have a singleton route... resource :shared ... and I want to
I have a shared library that I wish to link an executable against using

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.