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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:09:09+00:00 2026-05-17T02:09:09+00:00

i have a Log on in APS MVC 2.0 and if not logged on,

  • 0

i have a Log on in APS MVC 2.0 and if not logged on, i want to redirect the user to that page.

i found the way to do it is usin the RedirectAction (found several times on google, even on stack Overflow)

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%: ViewData["Message"] %></h2>
    <p>
        <% if (Request.IsAuthenticated) { %>
            Go to this page <%:  Html.ActionLink("Manage Payment Run", "ManagePaymentRun")%>
        <%} else { %>
          <%  return RedirectToAction("LogOn", "Account"); %>
        <% } %>
    </p>
</asp:Content>

Now, the problem is that i get “The name RedirectToAction does not exist in the current context”. I was wondering if anyone here knows why this happens, since my googling skill didnt even get close to finding anyone with a similar problem.

Thanks for your time.

  • 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-17T02:09:10+00:00Added an answer on May 17, 2026 at 2:09 am

    Unless I’m wrong, RedirectToAction is method used within a controller. It’s part of the Controller class and thus cannot be used from a view.

    I think you may need to read through this blog post for more info in helping you.

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

Sidebar

Related Questions

We've faced strange problem. We have log on service, that authenticates user, adds auth
I have a log function on my admin panel that checks user input for
I have log in functionality that will check for a session, if it not
I have a log method which saves to a file that is named the
I have a log file that I'm trying to append data to the end
I have a log file that I am reading to a string public static
I have a log that is really huge. (millions of rows) LogTable ------- ID
I have a log out button on my main menu and I want it
I have a log file in SqlServer that stores the time an application started,
I have log files that look like this... 2009-12-18T08:25:22.983Z 1 174 dns:0-apr-credit-cards-uk.pedez.co.uk P http://0-apr-credit-cards-uk.pedez.co.uk/

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.