Last post Sep 22, 2015 01:55 PM by jkjhse
Sep 21, 2015 07:26 AM|LB79|LINK
I really don’t know what to enter into a search engine for this so I hope my question makes sense.
I'm building a website that will include a profile page for each registered user (eg. domain.com/username), but I don’t want to actually create a copy of the profile page for each individual user.
All of the users information is in a database so I can view each users details in a single template page (template.cshtml).
What I want is to enter the web address (domain.com/user1) and for it display the page template.cshtml but showing the details from the database for user1
I'm sure the mainstream sites must do something similar (like Facebook – I can’t imagine they have 500m individual profile pages).
Id be grateful if someone can give me directions on how to achieve this, or tell me what its called so I can search it properly.
Sep 21, 2015 08:05 AM|wavemaster|LINK
No they don't.
User data in tables and then a page that displays the information based on the userid you pass to the page.
I think you are hung up on calling this a "template page" You create a page, whatever name, and design it to show the information you want.
Inside that new page, you will query the db for the information you need for one user, and display that.
Sep 22, 2015 01:55 PM|jkjhse|LINK
var userid = UrlData.ToString();
var sql = "SELECT * FROM UserProfiles WHERE UserID=@0";
var userdata = db.QuerySingle(sql,userid);
//and so on