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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:01:24+00:00 2026-06-03T21:01:24+00:00

I want to create a public profile page for every user on my website.

  • 0

I want to create a public profile page for every user on my website. Something very similar to SO user profiles. But I don’t want to expose Guid I’m using as PK. Neither I know how unique will be a user name over the lifetime of the website to use it in url.

The question is how SO itself is doing this in url https://stackoverflow.com/users/242506/nubm ? The user name can be removed and the url still works but should I generate some publicly viewable UserId next to my Guid that I can use in links to the profile page and display it in urls?

I’ve found similar questions Should I expose a user ID to public? or How do I create a "public" user profile page in ASP.NET (3.5) but they are not exactly what I want to know.

  • 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-03T21:01:25+00:00Added an answer on June 3, 2026 at 9:01 pm

    You can do two things.

    First you can create an extra incremental ID on the database, either on the ASP.NET tables or a new map table, and give a smaller number connected to the Guid. Why a smaller number? Because a Guid is 128 bits and is too big to be used as it is on the url.

    Then, you can use this smaller number, which is connected with the Guid, on the url. The only exploit issue here is that anyone can find all the list of your users. SO have this public so is not an issue if you have them also public. SO use the number in their URL for finding the user and the user name is for better SEO. The number stays the same but the name can change, so only the number is used to locate the user.

    The second solution is to compress and encode the 128 bit Guid number to a 73 base character string. I chose a 73 base character because 73 is the permitted un-escape characters on the url.

    Here are some examples that I found for make this converting:

    http://www.singular.co.nz/blog/archive/2007/12/20/shortguid-a-shorter-and-url-friendly-guid-in-c-sharp.aspx

    http://jopinblog.wordpress.com/2009/02/04/a-shorter-friendlier-guiduuid-in-net/

    http://buildmaestro.wordpress.com/2011/04/27/installscript-to-transform-guid-into-compressed-guid/

    a simple convert to base64 (from Dave Transoms)

    public static string Encode(Guid guid)
    {
      string encoded = Convert.ToBase64String(guid.ToByteArray());
      encoded = encoded
        .Replace("/", "_")
        .Replace("+", "-");
      return encoded.Substring(0, 22);
    }
    
    public static Guid Decode(string value)
    {
      value = value
        .Replace("_", "/")
        .Replace("-", "+");
      byte[] buffer = Convert.FromBase64String(value + "==");
      return new Guid(buffer);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create user profile with image. That user can upload his photo,
I want to create an extension method like this public static bool AllConsecutives(this IEnumerable<int>
I want to create whois class like that public class DomainInfo { public string
I want to create 1MB String for benchmark,so I writed code as follow: public
I want to create the dictionary of all the ViewModels. public static Dictionary<string, WeakReference>
I want to create a class with a nested enum. public class Foo {
I want to create a template class in C#, for example: public class Foo<T>
I wanna create a public repo (bare repo) which contains multiple submodules. I want
I want put a button on android edittextpreference. I create a custom editextpreference: public
I have a public website created with xPages, My user are not logged to

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.