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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:06:51+00:00 2026-05-26T03:06:51+00:00

All the users on my site have public-facing profile pages. I am using URL

  • 0

All the users on my site have public-facing profile pages. I am using URL rewriting to change urls from the form http://mysite.com/profile.aspx?id=sdsdfsdsdfsdfdsdffsdfsdf into http://mysite.com/Username like this (in my global.asax file):

static Regex _handleRegex1 = new Regex("/(?<hndl>[\\w]+)/?$", RegexOptions.Compiled);

void Application_BeginRequest(object sender, EventArgs e)
{

    System.Text.RegularExpressions.Match handleMatch = _handleRegex1.Match(Request.Url.LocalPath);
    if(handleMatch.Success){
        String handle = handleMatch.Groups[1].Value;

        using (SqlQuery query = new SqlQuery("[dbo].[sp_getUserIdByHandle]"))
        {
            try
            {
                query.AddParameter("@handle", handle, System.Data.SqlDbType.NVarChar, false);
                query.AddParameter("@userId", new Guid(), System.Data.SqlDbType.UniqueIdentifier, true);

                query.ExecuteNonQuery();

                Object userId = query.GetOutParameter("@userId");

                if (userId == DBNull.Value)
                {
                    Response.Redirect("~/default.aspx");
                }
                else
                {
                    Context.RewritePath(string.Format("~/profile.aspx?id={0}&{1}", userId, Request.QueryString));
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
}

This works fine. However, if I do a postback to the server, the URL changes from something like /username to the form /profile?id=5ab47aa3-3b4d-4de6-85df-67527c9cdb52&, which I want to hide from the user.

I thought about doing something like Response.Redirect(Request.RawUrl); to sent the user back to the right page. However, Request doesn’t seem to contain any information about the desired URL.

Is there any way to find the pre-rewritten URL?

  • 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-26T03:06:52+00:00Added an answer on May 26, 2026 at 3:06 am

    What platform are you on? If IIS 7 you would be best off using IIS URL Rewrite 2.0. You can find some suggestions on dealing with postback using this.

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

Sidebar

Related Questions

Right now we have AD/Exchange to manage all of our users logins/e-mail on-site at
I have a site that allows public access to some pages, but requires a
I have a public facing hobby site that gets about 3000 unique visitors a
I'm using Rails 3 for my website. I have cases where my site users
On my site, users have public profiles that can be accessed via http://mysite.com/vanity_url .
I have a site where users can make posts. The users can be from
I have a simple form in my MVC3 site that allows users to create
I want to have site wide default settings for all jQuery validation uses on
i have a search page in my site, where user can search all the
I want to display a list of all the users in my site but

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.