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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:09:28+00:00 2026-05-29T04:09:28+00:00

I am working on a content management system , where i have a controller

  • 0

I am working on a content management system , where i have a controller that display all the articles that are assigned to the current login user for his review, then the user can either approve or reject this article. To make sure that the user only sees the articles that are assigned to him i wrote the following query:-

public IQueryable<Article> MyApproval() 
{ 
    Guid id = (Guid)Membership.GetUser().ProviderUserKey;   
    return from article in db.Articles  
           where article.Approval_ID == id  && article.Article_status_ID == 1  // 1 represents new articles in Article_status table 
           orderby article.Article_ID descending 
           select article; 
}

But i found that the user might manually modify the URL and change the article id to an article that he is not assigned to and then he can approve or reject it; so i add the following check before the edit action method

[Authorize] 
public ActionResult Edit(int id) 
{ 
    Article articleapproval = articletyperepository.GetArticle(id); 

    if (!articleapproval.Isapproval(User.Identity.Name)) 
        return View(“InvalidOwner”); 
    else
    { 
        articleapproval.Published_Date =  DateTime.Now; 
        return View(articleapproval);} 
    }
}

So i have the following three questions:-

  1. will the check on the controller level prevent the user from modifying the URL and accessing an article that he is not the assigned for

  2. Should i add the below check on the POST version of the edit action method also (in addtion to the GET version), or it will be considered as unnecessary check?

    if (!articleapproval.Isapproval(User.Identity.Name)) 
        return View(“InvalidOwner”);
    
  3. what is better to pass the User.Identity.Name to the helper method (as i am currently doing) ? or to modify the helper method to generate the User.Identity.Name inside it as follow?

    public partial class Article
    {      
        public bool Isapprova ()
        { 
            return HostedBy.Equals(User.Identity.Name, StringComparison.OrdinalIgnoreCase);}
        }
    }
    
  • 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-29T04:09:30+00:00Added an answer on May 29, 2026 at 4:09 am

    Will the check on the controller level prevent the user from modifying
    the URL and accessing an article that he is not the assigned for

    Yes

    Should i add the below check on the POST version of the edit action
    method also (in addtion to the GET version), or it will be considered
    as unnecessary check?

    You should check both GET and POST

    what is better to pass the User.Identity.Name to the helper method (as
    i am currently doing) ? or to modify the helper method to generate the
    User.Identity.Name inside it as follow?

    The helper method does not need to know as to how to retrieve the current user’s name. Your implementation is fine.

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

Sidebar

Related Questions

im working on a content management system for that i have to download a
I'm working on a PHP content management system and, in testing, have noticed that
I have WAMP 2.0 installed and am working on a content management system using
I am working on a content management system at work. I will have a
I have been working on a content management system (nakid) and one of my
I'm currently working on an asp.net-mvc content management system. It would be incredibly useful
I'm working on a site that allows users to purchase digital content and have
I am building a website that is basically a small Content Management System. (in
I'm working on a Content Management System, and so far so good. I'm trying
I'm working on my own simple Content Management System to implement on my projects

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.