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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:57:05+00:00 2026-05-30T00:57:05+00:00

i have the following Ajax.actionlink inside a view to add an answer under a

  • 0

i have the following Ajax.actionlink inside a view to add an answer under a question:-

 @Ajax.ActionLink("Add Answers",
 "Create", "Answer",
new { questionid = question.QuestionID},

new AjaxOptions
{

    InsertionMode = InsertionMode.Replace,
    HttpMethod = "Get",
    UpdateTargetId = "removetable"
})

while will call the following action method:-

public ActionResult Create(int questionid)
    {

        ViewBag.IsRight = new SelectList(repository.FindAllAnswerDescription().ToLis(), "IsRight", "description", 1);
        ViewBag.questionid = questionid;
         Answer answer = new Answer();
         return PartialView("_answer",answer); } 

so my question is will a hacker be able to modify the new { questionid = question.QuestionID}, parameter send by the ajax link ? and if yes how i can avoid this.
BR

Edited:-
i am doing the following check using a helper method (IsauthorizedBy) on the post action method to check if the user is authorized to answer a question or not:-

            [HttpPost]
            public ActionResult Create(int questionid, Answer a)
            {
    q = repository.findquestion(questionid);
    if ((q == null) ||  (!q.IsauthorizedBy(User.Identity.Name))){
return ("error");}
                if (ModelState.IsValid)
                {
                repository.AddAnswer(a);
                    repository.Save();
                    return PartialView("_details",a);
                }
return(a);}

so will it handel a hacker who will try to modify the question id and answer a question he is not authorized to answer.
BR

  • 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-30T00:57:07+00:00Added an answer on May 30, 2026 at 12:57 am

    Yes but you want to ensure on the server side they have access to this question by querying their permissions and some database scheme in place ensuring they have access to this. If it’s not feasible then you can use
    Html.AntiModelInjectionFor from
    mvcsecurity.codeplex.com plus
    [ValidateAntiModelInjection()]

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

Sidebar

Related Questions

i have the following ajax.actionlink :- <div id =link> @Ajax.ActionLink(Add New Answer, Create, Answer,
i have the following ajax.actionlink:- @Ajax.ActionLink(Delete, Delete, Answer, new { id = answer.AnswersID },
I have the following ajax.actionlink. i want to add click event to this actionlink.
I have the following @Ajax.ActionLink code: @Ajax.ActionLink(Assign Ownership, AssignOwnership, new { techLogCode = Model.TechLog.Code,
I have the following view definition in my asp.net mvc website: <% Using Ajax.BeginForm(UsrCtlChangePassword,
I have a link as follows. @Html.ActionLink(Create Report, Screenreport, Reports, null, new { @class
One more question concerning JSF.Particularly, Primefaces. Have following problem with ajax update of elements
I have this code in my view: columns.Bound(o => o.jobname).Width(100); columns.Bound(o => o.objid) .Format(Ajax.ActionLink(delete,
If I have the following ajax call (inside a function) how do I go
Let's say I have the following jQuery AJAX call: $.ajax({ type: POST, url: MyUrl,

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.