I'm looking for a way to allow for public user profiles with a nice URL, for example: www.mysite.com/john
I'm thinking that I should perhaps somehow inject an event listener (or url rewrite rule) so that when a page request arrives and a search for an Umbraco pages comes up empty, it would then look for user profiles (with userdifend names or something) before resulting in a 404.
Am I on the right track here? or am I a) makeing this too complicated and/or b) there is allready a way/solution/package that solves this nicely.
I think I would rather like this to be a dynamic thing, rather than a actual page. Due to a high volume of members... right?
Any help, tips and directions would be appreciated.
You could create an event handler on new member creation and create a blank page for them with their first name and the template for that page displays data for currently logged in user.
The page name would be persons name so http://somesite/jack though you would need to mess around it more than one jack best way would be Url rewrite page with query but i would use guid of member as the query string parameter and then in code do new Member(guid) that way if you have more than one jack you dont have issue.
I'm sort of looking for a way to either auto generate unique Nice URLs from the user's name, or allow the user to make up their own (wich would check for collitions).
I guess my question is becoming; how would I create a url-rewrite rule (or similar mechanism, if availale in Umbraco) that grabs the requested url and translate into a query string and sends to a Umbraco page (that would use the same templates and features as all other pages in Umbraco).
you will see a page with the member information, yet that page doesn't exist as such, it is a generic member details page that takes the name of the member as parameter with a custom Url rewrite rule:
where (John-Doe) is the members name (John Doe). I would also like to have a (-) replace any spaces that occur within the name. Currently I have tried following your example and have used this code:
This URL also directs me to a 404 error page. Im not sure if I have something set up wrong but I have reviewed the UrlRewritingNet20.pdf and my web.config file looks to be all correct. Do you have any suggestions or solutions that might be helpful with this issue? I'm new to UrlRewriting so I may be missing something simple.
It's then up to you to write a macro to pick up the "name" querystring and retrieve the appropriate member. Hope this makes sense? This is why it may be more appropriate to keep the member ID somewhere in the URL so you don't end up with the possibility of duplicate names - and subsequently, a bug when you go to a given profile URL.
Member customized public profiles with nice urls
Hi,
I'm looking for a way to allow for public user profiles with a nice URL, for example: www.mysite.com/john
I'm thinking that I should perhaps somehow inject an event listener (or url rewrite rule) so that when a page request arrives and a search for an Umbraco pages comes up empty, it would then look for user profiles (with userdifend names or something) before resulting in a 404.
Am I on the right track here? or am I a) makeing this too complicated and/or b) there is allready a way/solution/package that solves this nicely.
I think I would rather like this to be a dynamic thing, rather than a actual page. Due to a high volume of members... right?
Any help, tips and directions would be appreciated.
Thanks.
You could create an event handler on new member creation and create a blank page for them with their first name and the template for that page displays data for currently logged in user.
Regards
Ismail
But how would that provide me with a custom nice URL? Would'n I also be creating a page node, wich would mess up my tree?
/jack-> shows the puiblic profile for Jack
/jill -> show the public profile for Jill
typical solution is ofther a page behind that recives the request via query string through url-rewrite.
/jack would actually be sent to /profile.aspx?id=jack
But what would be the most practical thing here, while not messing things up for Umbraco ?
The page name would be persons name so http://somesite/jack though you would need to mess around it more than one jack best way would be Url rewrite page with query but i would use guid of member as the query string parameter and then in code do new Member(guid) that way if you have more than one jack you dont have issue.
Regards
Ismail
I'm sort of looking for a way to either auto generate unique Nice URLs from the user's name, or allow the user to make up their own (wich would check for collitions).
I guess my question is becoming; how would I create a url-rewrite rule (or similar mechanism, if availale in Umbraco) that grabs the requested url and translate into a query string and sends to a Umbraco page (that would use the same templates and features as all other pages in Umbraco).
Thanks, for the input so far though..
Hi Halldor,
I basically did the same thing on one of my last sites. If you go to
http://www.consumersinternational.org/our-members/member-directory/ACA%20-%20Albanian%20Consumers%20Association%20-%20Shoqata%20e%20Konsumatorit%20Shqiptar
you will see a page with the member information, yet that page doesn't exist as such, it is a generic member details page that takes the name of the member as parameter with a custom Url rewrite rule:
In the case of members you can easily get the member by name instead of id.
Hope that makes sense and helps,
Sascha
Thank you Sascha, this is pretty much what I was looking for (including the confirmation of a working solution) !
Fantastic, glad I could help out. :)
@Sascha Wolter
I'm having a little bit of difficulty following your example above. I'm trying to do the exact same thing tho.
Currently my members have a page that displays all of their info and the URL looks like this:
but I would like for them too look like this:
where (John-Doe) is the members name (John Doe). I would also like to have a (-) replace any spaces that occur within the name.
Currently I have tried following your example and have used this code:
But that just produces a URL that looks like this:
This URL also directs me to a 404 error page. Im not sure if I have something set up wrong but I have reviewed the UrlRewritingNet20.pdf and my web.config file looks to be all correct. Do you have any suggestions or solutions that might be helpful with this issue? I'm new to UrlRewriting so I may be missing something simple.
Thank you in advance!
Hi FarmFresh,
This will create a rewrite from /home/directory/John-Doe to /home/directory/member?name=John-Doe :
It's then up to you to write a macro to pick up the "name" querystring and retrieve the appropriate member. Hope this makes sense?
This is why it may be more appropriate to keep the member ID somewhere in the URL so you don't end up with the possibility of duplicate names - and subsequently, a bug when you go to a given profile URL.
Best,
Benjamin
is working on a reply...