Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my code please help me to sort out it's giving me Error.and i have installed url Rewrite module.

original url :
CSS
webasp2.asp?ID=1&Name=textname

and Rewriteurl:
CSS
webasp2/textname


i want make dynamically not static.

CSS
HTTP Error 500.52 - URL Rewrite Module Error.
The condition's expression "{DB:{R:1}}" is not valid.


table is
SQL
CREATE TABLE [dbo].[RewriteTable](
    [OriginalUrl] [nvarchar](256) NOT NULL,
    [NewUrl] [nvarchar](256) NOT NULL
) ON [PRIMARY]

store procedure
SQL
Create PROCEDURE [dbo].[GetRewrittenUrl]
@input nvarchar(256)
AS
SELECT rt.NewUrl
FROM dbo.RewriteTable rt
WHERE rt.OriginalUrl = @input




Config File code:
XML
<system.webServer>
   <rewrite>
     <providers>
       <provider name="DB" type="DbProvider, Microsoft.Web.Iis.Rewrite.Providers, Version=7.1.761.0, Culture=neutral, PublicKeyToken=0545b0627da60a5f">
         <settings>
           <add key="ConnectionString" value="Data Source=DOTNET-PC\SQLEXPRESS; Initial Catalog=JigarMVC;Persist Security Info=True;User ID=sa;Password=sql123#;" />
           <add key="StoredProcedure" value="GetRewrittenUrl" />
           <add key="CacheMinutesInterval" value="0" />
         </settings>
       </provider>
     </providers>
     <rules>
       <rule name="DbProviderTest" stopProcessing="true">
         <match url="(.*)" />
         <conditions>
           <add input="{DB:{R:1}}" pattern="(.+)" />
         </conditions>
         <action type="Redirect" url="{C:1}" appendQueryString="false" />
       </rule>
     </rules>
   </rewrite>
 </system.webServer>
Posted
Updated 8-Mar-17 17:20pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900