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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:51:50+00:00 2026-06-03T17:51:50+00:00

This question has to do with the MVC framework and file arrangement conventions within

  • 0

This question has to do with the MVC framework and file arrangement conventions within the MVC project folders in VS 2010. It also has to do with filename\path conventions for project files (referencing them from *.aspx and *.html).

To assist in answering the question I created a sample project titled “PAPlus.Asp” (a made-up name). Steps to reproduce: open VS2010SP1Rel->File->NewProject->ASP.Net MVC 2 Empty Web Application->Name = “PAPlus.Asp”

My question is this: if I create a MVC 2.0 application (example below) and want to link a *.html file that is in my project folder located at ..\PAPlus.Asp\Views\Home\ShowCuteDog.html how do I a href the html file from within index.aspx?

I am using the following DataProvider:

  <connectionStrings>

    <add name="PaPlus"
         connectionString="Data Source=|DataDirectory|PAPlus.sdf"
         providerName="System.Data.SqlServerCe.4.0"/>

  </connectionStrings>

I created the following:

namespace PAPlus.Asp.Models
{
    public class User
    {
        public int UserId { get; set; }
        public string UserName { get; set; }
    }
}

namespace PAPlus.Asp.Models
{
    public class PaPlus : DbContext
    {
        public DbSet<User> Users { get; set; }
    }
}

namespace PAPlus.Asp.Controllers
{
    public class HomeController : Controller
    {
        PaPlus _paPlus = new PaPlus();

        public ActionResult Index()
        {
            var users = from u in _paPlus.Users
                        select u;

            return View(users);
        }

    public ActionResult Create()
    {
        return View();
    }

    [HttpPost]
    public ActionResult Create(User newUser)
    {
        if (ModelState.IsValid)
        {
            if (_paPlus.Users.Any(d => d.UserName == newUser.UserName))
            {
                ModelState.AddModelError("UserName", "The username is not unique");
                return View(newUser);
            }

            _paPlus.Users.Add(newUser);
            _paPlus.SaveChanges();

            return RedirectToAction("Index");
        }

        return View(newUser);

    }

}
}

I also created VIEWS but they too long to post here. I will continue my explanation showing the body of index.aspx:

<body>
    <div>   
        <h1>Application Users</h1>
    <ul>    
    <%
        foreach (User d in Model)
        {%>
        <li> 
            <%=d.UserName%> (<%=d.UserId%>)
        </li>
    <%
        }%>
    </ul>
    <p>
        <%=Html.ActionLink("Create New User", "Create")%>
    </p>
    <p>
        <a href="Views/Home/ShowCuteDog.html">Navigate to Cute Dog Page!</a>
    </p>
    </div>
</body>

With all of the above explained, I can target a specific line that I would like assistance with:

<a href="Views/Home/ShowCuteDog.html">Navigate to Cute Dog Page!</a>

Obviously the path to ShowCuteDog.html is invalid. However, it seems no matter what I do I cannot enter a valid path.

I would like to know how to open ShowCuteDog.html using the a href

I would also like to know where I should store ShowCuteDog.html within my MVC project solution folder structure (/Views/Home/ seems like the best place, perhaps I am wrong?)

Thank you in advance.

  • 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-06-03T17:51:55+00:00Added an answer on June 3, 2026 at 5:51 pm

    You should not put content under Views that will be directly linked. Browser access to that path is blocked in Views/web.config by default, and for very good reasons: you don’t want users directly loading files from there.

    So you should put plain html somewhere else; perhaps in /html instead? Then link it as <a href="/html/cutepuppies.html">

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

Sidebar

Related Questions

This question has been asked in a C++ context but I'm curious about Java.
This question has been puzzling me for a long time now. I come from
This question has in the back of my mind for some time, sorry if
This question has been asked in various forms in a number of different forums,
This question has been bugging me for some time. I always picture launching my
This question has been asked before but the answers aren't always clear or are
This question has been bugging me for some time. I've already developed a couple
This question has been asked before somewhat, but I hope mine differs. My situation
This question has two parts (maybe one solution?): Sample vectors from a sparse matrix
This question has been asked before perhaps multiple times, but I can't get the

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.