I am using urlrewriter.net
my intended url is like /articles/3/name_of_article/articles.aspx
& actual is articles.aspx?article =3;
(3 is just taken, it can be any number)
i am using regex like this
<rewriter>
<rewrite url="^/articles/(.+)/(.+)" to="/articles.aspx?article=$1" />
</rewriter>
it does not work, also if i delete module dll from references then also no exception is
thrown.
1) how can ensure that module is loaded (via code)?
2) is my regex correct?
my web.config contains this:
<configSections>
<section name="rewriter" requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,
Intelligencia.UrlRewriter" />
</configSections>
&
<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule,
Intelligencia.UrlRewriter" name="UrlRewriter" />
<add name="ScriptModule"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
2) is my regex correct?
No, you should probably change it to
^/articles/([^/]+)/.+$, otherwise the first capture will gobble up “3/name_of_article” and not just “3”, and you don’t need the second capture group. You can also write it with a non-greedy match in the capture group, e.g.^/articles/(.+?)/.+$.