protected void Application_BeginRequest(Object sender EventArgs e) {
string strCurrentPath;
strCurrentPath = RequestPath;
//make sure that it ends with aspx This is some quick validation on the path
//This will shortcut processing for images and other files (WebResourceaxd for example)
if(SystemIOPathGetExtension(strCurrentPath)EndsWith(
aspx true SystemGlobalizationCultureInfoInvariantCulture)) {
string strCustomPath;
string qString = RequestQueryStringToString();
if(qString != stringEmpty)
qString = & + qString;
strCurrentPath = strCurrentPathToLowerInvariant();
string appRoot = GetAppRoot(strCurrentPath);
//string pageName = ;
// the URL contains this folder name
//ResponseWrite(strCurrentPath);
if(strCurrentPathIndexOf(catalog/ StringComparisonInvariantCultureIgnoreCase) > ) {
appRoot = appRootReplace(catalog/ );
strCustomPath = appRoot + catalogaspx?guid= + SystemIOPathGetFileNameWithoutExtension(strCurrentPath) + qString;
// rewrite the URL
ContextRewritePath(strCustomPath false);
}
else if(strCurrentPathIndexOf(product/ StringComparisonInvariantCultureIgnoreCase) > ) {
appRoot = appRootReplace(product/ );
strCustomPath = appRoot + productaspx?guid= + SystemIOPathGetFileNameWithoutExtension(strCurrentPath);
// rewrite the URL
ContextRewritePath(strCustomPath false);
}
}
}