How do I create a query string like facebook.com/username?
This feature is called URL Routing. If you are using MVC, then this feature is included in the MVC Framework. But if you are using Web Forms application, you need to do this tutorial.
For a Web Forms application, you can use the Microsoft.AspNet.FriendlyUrls Nuget package to make your application generate the URL you want.
Refer http://www.devcurry.com/2013/05/friendly-urls-in-aspnet-web-forms.html
http://www.hanselman.com/blog/IntroducingASPNETFriendlyUrlsCleanerURLsEasierRoutingAndMobileViewsForASPNETWebForms.aspx (Microsoft recommended)
source to share
This is usually done with some kind of structure, but the concept is pretty simple -
If you are trying to do it quickly, you will want to do your research on which it can be used, but I will explain the principle that makes it work -
In your server config (like .htaccess) you will rewrite *.aspx
file requests by going to the central index.aspx
- this file, then load your index as you want -
In your case, you will need part /username
and query the database for a user with that username, get the associated data and do everything with it.
It's a relatively simple concept, and you could write something of your own to load the request into your code, but you're probably better off looking for some kind of (micro) structure that handles everything for you ...
Good luck -!
source to share