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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T05:35:23+00:00 2026-06-19T05:35:23+00:00

I’m building a small application that will have multiple users using ASP.NET MVC, but

  • 0

I’m building a small application that will have multiple users using ASP.NET MVC, but I’m not sure how to handle user authorisation in the scenario below. I may be missing something obvious as I’m still learning, so any advice is appreciated.

Basically, to illustrate my problem, consider that I’m building a very small email like messaging system. Here is the action to read a message:

/Message/ReadMessage/1

Where Message is the controller, ReadMessage the action and 1 is the MessageId.

Now this message was for “Bob” and in the db his UserId is stored with the message. Another user called “Fred” has also received a message and the MessageId for this is 2.

In my application, there would be no way for Bob to see Fred’s messages on the page directly or through links (messages should be private to each user), so what is the best way for me to protect from Bob simply changing the MessageId in the URL manually from 1 to 2 and viewing Fred’s message?

As a current solution to this, I have a very simple check at the beginning of my controller action which compares the UserId stored with the message to the current UserId and if they don’t match, the user is redirected (to say, their inbox).

Is this a suitable solution for such a scenario? I get the feeling that while this works now, it isn’t the best approach to this problem. Thanks for the help.

  • 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-19T05:35:24+00:00Added an answer on June 19, 2026 at 5:35 am

    your controller needs to check that the current user is allowed to access the resource ( message in this case )

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

Sidebar

Related Questions

I'm building a small web application with ASP.NET MVC 2, using db4o as a
I am currently building a very small/simple web application in ASP.NET MVC with ADO.NET
Background: I'm building a small application that will be run daily, pulling data from
I have a small application that I am building a Chat application into, so
Using PHP, I am building an application that is MySQL database resource heavy, but
I'm building a small application that pulls statistics from an API I have no
I have this small application that I'm building as an exercise to learn the
Small problem here with an MVC app that I'm not sure how to figure
I have developed a system for a client using ASP.Net MVC 3 and Entity
I'm building a small application that will basically display 3 forms... the first one

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.