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

The Archive Base Latest Questions

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

In my ASP .NET MVC 3 web application, I am using a lot of

  • 0

In my ASP .NET MVC 3 web application, I am using a lot of partial views. I am using these partial views in some cases through normal render calls

<div id="attributes">
   @Html.Partial("_DeviceAttributesPartial", Model.DeviceAttributes)
</div>

and in other cases using AJAX:

$.ajax({
   url: '@Url.Action("GetDeviceAttributes")',
   type: 'POST',
   data: { deviceID: device, deviceTypeID: devicetype, deviceModelID: devicemodel },
   success: function (result) {
      // when the AJAX succeeds refresh the device model drop down holder
      $('#attributes').html(result);
   }
});

I was trying to find a way to stop users from going directly to my partial view ActionResults such as this one:

public ActionResult GetDeviceModelList(int deviceTypeID)
{
   var model = new EditDeviceViewModel();

   var deviceType = _db.DeviceTypes.Single(t => t.ID == deviceTypeID);
   model.DeviceModelList = new SelectList(_db.DeviceModels.Where(m => m.DeviceType.ID == deviceType.ID), "ID", "Model");

   return PartialView("_DeviceModelListPartial", model);
}

I stumbled up on this answer to simply make the action private. I gave it a try and it seems to work, however I feel uneasy about doing that, not knowing what other side effects might happen.

So my questions are:

  • Is setting actions to private a sensible thing to do?
  • What other side effects might occur from doing this?
  • How about actions that are only available through a POST?

NB: Most of the partial action result functions are [HttpPost] so I don’t believe they are accessible anyway.

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

    Reducing an action visibility will prevent that action from being available outside the controller. Actions that are decorated by the [HttpPost] attribute are available to everybody but only via a POST http request, which is a little beyond the average user to do.

    Consider decorating the actions with the [ChildActionOnly] attribute that you won’t be accessing via a POST, instead decorate these actions with [HttpPost].

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

Sidebar

Related Questions

I am building an ASP.NET MVC web application and I'm using jQuery for some
What are the licences required for an asp.net (MVC) web application using sql server
I am trying to publish an Asp.net MVC web application locally using the NAnt
I am building a web application using ASP.NET MVC that has two very distinct
I'm developing a web application using ASP .NET MVC 1.0 and jQuery (including the
I am designing a web application using the ASP.net MVC framework. I would like
I need to create a web application using ASP.NET MVC, jQuery and web standards
I'm using a ExtJS DateField control in an ASP.NET MVC web application. I've set
I'm using ASP.NET MVC to develop a web application, deploying to IIS 7. I've
I'm am building my asp.net web application using MVC (Preview 5), and am also

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.