Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: URL Rewrite 9.0

  1. #1
    brianperry is offline Member
    Join Date
    Sep 2005
    Posts
    41

    Default URL Rewrite 9.0

    is there a way to add tokens in the rewrite? I need the {ProductType} so i can do

    <add name="Product" url="{ProductType}/{ProductID}/{SEName}.aspx" virtualPath="~/showproduct.aspx" checkPhysicalUrlAccess="false" />

  2. #2
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    Sure, but you'll need the source code. Open up the SE.cs file in the AspDotNetStorefrontCore project. Find the MakeObjectLink method. You'll need to add the product type to the RouteValueDictionary
    Code:
    var dictionary = new RouteValueDictionary();
    dictionary.Add(ObjectName + "ID", ObjectID);
    dictionary.Add("SEName", tmp);
    dictionary.Add("ProductType", "this-is-the-product-type");
    You'll have to run a query to get the product type for the current product from the database (just query against the ObjectID variable), then replace "this-is-the-product-type" with the value you get back from that query. Once you've done this, you can use {ProductType} (or {whatever-you've-specified-as-the-first-parameter-for-dictonary.Add}) in the product route in the routes section in the web.config
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>