Making a small extension to URLRewrite provider?

Vote:
 
Hi, We are creating a globalized EPiServer web site where several different domains will point to the same web site. However, we would like to return different content when robots.txt is requested depending on which domain name/host name the request is made from. For instance, when domain.se/robots.txt is requested, we would like to return the content of robots.txt.se, and when domain.com/robots.txt is requesed, the content of robots.txt.com should be returned. This should be transparent to the robot/visitor that actually makes the request. I've managed to do this by adding an event handler in Application_OnStart in global.asax: UrlRewriteProvider.ConvertingToInternal += new EventHandler(UrlRewriteProvider_ConvertingToInternal); In the UrlRewriteProvider_ConvertingToInternal method, I then get the e.Url (UrlBuilder) object and modify the Path property depending on certain rules (Regular expression). Seems to work fine. However, I have a few questions about this. 1. Is this the way you're supposed to modify URLs? Writing your own subclass/implementation of FriendlyURLRewriteProvider isn't neccesary in this case, right? 2. Is the global.asax application_onstart the correct place to add this event handler? 3. Might there be any performance penalty since the UrlRewriteProvider_ConvertingToInternal method is called very frequently? We're thankful for any ideas or input! Thanks, Christoffer
#15928
Dec 12, 2007 18:12
Vote:
 
You may want to have a look at this: http://labs.episerver.com/en/Blogs/Ruwen/Dates/111218/112064/112154/
#16652
Dec 13, 2007 22:40
Vote:
 
I need to do something similar in 4.62 - is there an equivalent event I can hook into for this?
#16653
Mar 06, 2008 15:22
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.