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

  • Home
  • SEARCH
  • 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 6346469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:01:24+00:00 2026-05-24T21:01:24+00:00

Obviously depending on the type/context of data returned to a web front-end (in my

  • 0

Obviously depending on the type/context of data returned to a web front-end (in my case the setup is HTML/Javascript, .NET Csharp back-end and JSON as the data transport), if I have to return an ID say of a message that is an auto-generated primary key (Int64), what is the best way to “hide” this real ID?

For most things of course, I can understand it doesn’t make too much difference, however an application I am working on means if a user “guesses” an ID in the URL to pull back another record, it could prove to be a security issue..

There seems to be lots of ideas/commentary about methods, but nothing has quite clicked.

I was thinking of having an auto-generated primary INT, but also a secondary alternate GUID too. It would be the GUID returned to any front-end process, and of course the auto-generated primary ID would still be used in the backend..

The thinking of course is the GUID would be far more difficult to guess/obtain another one to access a record?

Any ideas or best practices people use?

Thanks in advance,
David.

  • 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-24T21:01:24+00:00Added an answer on May 24, 2026 at 9:01 pm

    Regarding security you have several aspects:

    • Session hijacking
    • Accessing/Modifying/Creating/Deleting records the user is not authorized to
    • Non-Authenticated access
    • Cross-Site* attacks
    • Man-in-the-middle attacks
    • etc.

    The measures to deal with these depend on your architecture and security needs.

    Since you don’t say much about your arhcitecture and security needs it is really hard to give any specific advice…

    Some points regarding “ID shouldn’t be guessable”:

    • “Correct” solution
      The problem goes away in the moment you implement authentication + autherization properly
      because properly implemented these two make sure that only authenticated users can access
      anything at all AND that every user can only access things he is allowed to. Even if an authenticated user knows the correct ID of something he is not allowed to access this would be secure because he would prevented from accessing it.

    • “weak solution”
      create a ConcurrentDictionary as a thread-safe in-memory-cache and put the real IDs plus the “temporary IDs” (for example upon first record access freshly generated GUIDs) in there. You can combine that temporary ID with some salt and/or encryption and/or hash of some connection-specific aspects (like client IP, time etc.). Then on every access you check with the ConcurrentDictionary and act accordingly… one positive effect: after app restart (for example app pool recycling) the same record gets a different ID because this is only an in-memory-cache… though this is hardly usable in a web-farming scenario

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

Sidebar

Related Questions

I have a project (of type 'jar') that (obviously) builds a jar. But that
Obviously it will vary depending on the compiler you use, but I'm curious as
I am looking to return a number of custom UITableViewCells depending on the type
Obviously MVC promotes separation of concerns. One thing we are struggling with is proper
Obviously the point of using named constants over magic numbers is for code clarity
Obviously, the typical WebForms approach won't work. How does one track a user in
Obviously it's early days, I do not know whether this is information that is
Obviously I'd like to not have to install an Oracle client (other than simply
Obviously, sets do not have any kind of ordering, so I cannot expect any
Although obviously not all scenarios can be covered by a single design, is it

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.