Greetings,
I need help with a rule entitled freelancerEducationRewrite. Below is my web.config file:
<?xml version="1.0" encoding="UTF-8"?><configuration><system.webServer><rewrite><rewriteMaps configSource="rewriteMap.config" /><providers><provider name="DB" type="DbProvider, Microsoft.Web.Iis.Rewrite.Providers, Version=7.1.761.0, Culture=neutral, PublicKeyToken=0545b0627da60a5f"><settings><add key="CacheMinutesInterval" value="1" /><add key="StoredProcedure" value="GetReWrittenURL" /><add key="ConnectionString" value="Server=localhost;Database=DBNAME;User Id=USERID;Password=PASSWORD;" /></settings></provider><provider name="DB2" type="DbProvider, Microsoft.Web.Iis.Rewrite.Providers, Version=7.1.761.0, Culture=neutral, PublicKeyToken=0545b0627da60a5f"><settings><add key="CacheMinutesInterval" value="1" /><add key="StoredProcedure" value="UserNametoID" /><add key="ConnectionString" value="Server=localhost;Database=DBNAME;User Id=USERID;Password=PASSWORD;" /></settings></provider></providers><rules><rule name="WebsiteRedirects" stopProcessing="true"><match url="(.*)" /><conditions><add input="{DB:{REQUEST_URI}}" pattern="(.+)" /></conditions><action type="Redirect" url="{C:1}" appendQueryString="false" /></rule><rule name="Canonical host name" stopProcessing="true"><match url="(.*)" /><conditions><add input="{HTTP_HOST}" pattern="^www.codebuyers\.com$" negate="true" /></conditions><action type="Redirect" redirectType="Permanent" url="http://www.codebuyers.com/{R:1}" /></rule><rule name="Canonical home page" stopProcessing="true"><match url="^(index|index\.cfm|default\.cfm)$" /><action type="Redirect" redirectType="Permanent" url="/" /></rule><rule name="Add trailing slash" stopProcessing="true"><match url="(.*[^/])$" ignoreCase="true" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" /><add input="{URL}" pattern="^.*\.(asp|aspx|cfm|cfc|axd|asmx|css|js|jpg|jpeg|png|gif|mp3)$" negate="true" ignoreCase="true" /><add input="{URL}" pattern="/skills" negate="true" /><add input="{URL}" pattern="/admin" negate="true" /><add input="{URL}" pattern="/ads" negate="true" /><add input="{URL}" pattern="/error" negate="true" /><add input="{URL}" pattern="/flash" negate="true" /><add input="{URL}" pattern="/forum" negate="true" /><add input="{URL}" pattern="/img" negate="true" /><add input="{URL}" pattern="/inc" negate="true" /><add input="{URL}" pattern="/javascript" negate="true" /><add input="{URL}" pattern="/projects" negate="true" /><add input="{URL}" pattern="/scripts" negate="true" /><add input="{URL}" pattern="/swfobject" negate="true" /><add input="{URL}" pattern="/templates" negate="true" /></conditions><action type="Redirect" redirectType="Permanent" url="{R:1}/" /></rule><rule name="LowerCaseRule1" stopProcessing="true"><match url=".*[A-Z].*" ignoreCase="false" /><conditions><add input="{URL}" pattern="^.*\.(cfm|cfc|axd|css|js|jpg|jpeg|png|gif)$" negate="true" ignoreCase="true" /></conditions><action type="Redirect" redirectType="Permanent" url="{ToLower:{URL}}" /></rule><rule name="SkillIDToTitleRewrite" stopProcessing="true"><match url="^coder-skills/([_0-9a-z-]+)" /><action type="Rewrite" url="skills/view-skill-details.cfm?skillID={R:1}" /></rule><rule name="SkillSubcatIDToTitleRewrite" stopProcessing="true"><match url="^skill-subcats/([_0-9a-z-]+)" /><action type="Rewrite" url="skills/view-skill-subcategory.cfm?subcatID={R:1}" /></rule><rule name="SkillCatIDToTitleRewrite" stopProcessing="true"><match url="^skill-cats/([_0-9a-z-]+)" /><action type="Rewrite" url="skills/view-skill-category.cfm?catID={R:1}" /></rule><rule name="freelancerEducationRewrite" stopProcessing="true"><match url="^freelancers/([_0-9a-z-]+)/education\.cfm$" /><conditions><add input="{DB2:{R:1}}" pattern="(.+)" /></conditions><action type="Rewrite" url="coder-education.cfm?userID={C:1}" /></rule></rules></rewrite><tracing><traceFailedRequests><add path="*"><traceAreas><add provider="ASP" verbosity="Verbose" /><add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" /><add provider="ISAPI Extension" verbosity="Verbose" /><add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" /></traceAreas><failureDefinitions statusCodes="200-999" /></add></traceFailedRequests></tracing></system.webServer></configuration>
Below is my stored procedure that is used with the DB2 Provider:
USE [DBNAME] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[UserNametoID] @input nvarchar(MAX) AS BEGIN DECLARE @return_value nvarchar(MAX) SELECT @return_value = END_USER_ID FROM END_USER WHERE END_USER_USERNAME = @input RETURN @return_value END
As you can see the DB2 stored procedure should take the username and output a string representing the user ID number.
http://www.codebuyers.com/coder-education.cfm?userID=5802531
http://www.codebuyers.com/freelancers/twalters84/education.cfm
The first URL should change into the second one. It appears like the URL redirect is working. However, the rewrite is causing the 404 error.
If you have a solution, please email me at twalters84@hotmail.com or add me on skype as twalters84
I am willing to pay for a solution.
Thank you!
Sincerely,
Travis Walters