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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:13:14+00:00 2026-05-26T13:13:14+00:00

I am new to MVC. I need to have two views (for same logic)

  • 0

I am new to MVC.

I need to have two views (for same logic) one for normal browser and one for mobile.
How I can I redirect to different view for Mobile?

right now i have two controller but i want to use only one controller (HomeController.cs) for both views.
I know this way, I should have my mobile views under “Home”.
Please help me to redirect to Mobile view using only one controller.

i am using below for redirect for now (with two controllers):

return RedirectToAction(“Index”, “Mobile”);

I am using framework 3.5 and MVC 2

  • 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-26T13:13:15+00:00Added an answer on May 26, 2026 at 1:13 pm

    I’m having a little trouble picturing your setup. My guess is you have the current setup:

    Controllers
        – HomeController.cs
        – MobileController.cs
    Views
        – Home
           –Index.aspx
        – Mobile
           –Index.aspx

    But you want:
    Controllers
         – HomeController.cs
    Views
        – Home
           –Index.aspx
        – Mobile
           –Index.aspx

    Is that correct?

    Update:

    Aas people mentioned below it’s one of those ‘that’s just how MVC works’ sort of deal. ‘Home’ is a location you can go to, but ‘Mobile’ is a specific type of page. If you add another area called “About” as new Views subfolder, where would you put your mobile folder? What is mobile now supposed to handle? If mobile is not supposed to replicate the regular site, then it should have its own controller, even if it replicates some code (don’t forget you can create classes outside the controllers that can do the brunt of the work that any controller can call).

    On the other hand if you want a mobile version of each of your pages you should be adding them under the views folder for each route. For example:

    Controllers
         – HomeController.cs
    Views
        – Home
            – Mobile
             — Index.aspx
           –Index.aspx

    I’m not exactly sure where you are doing the logic to figure out if they are on a mobile platform, but assuming for now it’s in the controller somewhere in your HomeController.cs you then have:

    public ActionResult Index() { 
    if([check for mobile])
    {
    return View("Mobile/Index");
    } else {
    return View("Index"); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started a new mvc project and clicked on project\properties\web - use local
I've just create a new MVC project, and have made no changes at all,
I can't find the Html.Image method in new MVC RC version. Please somebody give
I have two entities – PopularTutorial and Blog. This data need to be displayed
I have a MVC 3 app. There are mainly two zones regarding security. The
I have a ASP.NET MVC 3 view with esentially two forms, but which reside
I have two sites one is written in asp.net webforms and the other one
This is my goal: I need to two (or more) Areas for my MVC
I have an MVC application, which has two areas - Administrator, and User. What
I have two classes that each need an instance of each other to function.

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.