0

When I try to pass parameters in url I used GET to do so, but I noticed that facebook and some other sites passing variables by building url in different way like this "facebook.com/user1". I think "user1" is passed and there is no real directory named "user1" in facebook.com base directory.

how to use "mysite.com/user1" instead of "mysite.com/?user=user1" to maintain user id, without creating a directory named "user1" in base directory?

Programming language: C#. IIS version: 7.5

Thanks in advance.

2 Answers 2

1

Two ways:

1) Use ASP.NET MVC by using your own Route. For more about ASP.NET MVC, you can refer this:

However I suggest you starting from beginning for the 2nd link.

2) If you are using a general ASP.NET WebForm, Please use UrL-ReWriter. another good torturial at:http://www.tutorialized.com/tutorial/URL-Rewriting-in-ASP.NET-using-URLRewriter.Net/38861

Sign up to request clarification or add additional context in comments.

Comments

0

You can generate the URL as below

Request.Url.GetLeftPart(UriPartial.Path) + "?user=" + USERID

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.