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.

user3222589
  • 184
  • 1
  • 13

2 Answers2

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

Community
  • 1
  • 1
0

You can generate the URL as below

Request.Url.GetLeftPart(UriPartial.Path) + "?user=" + USERID
Siva Charan
  • 17,940
  • 9
  • 60
  • 95