!! 2.0$ UrlRewritingNet. UrlRewrite$ "#$%&'()*)+#(! , '/)!0'+('/)!1!23#&*4!5*(6)! 0007 8 9 : 9 ; 0 9 < 2 < = > 7 =;2 ! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!B! ! Table&of&contents! 03*)!+4!8/-9'?/+)+(@=')78/-9'?/+)'C!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!D! 03E!/'?/+)+(@!&E!8/-4C!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!D! F%($)+#(4!#G!8/-9'?/+)+(@=')78/-9'?/+)'!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!D! :+&+)*)+#(4!#G!8/-9'?/+)+(@=')78/-9'?/+)'!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!D! =#)* '!)3+(@4!.E!6'H'-#I+(@!*!?'.!*II-+$*)+#(!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!J! K*L'!E#%/!/'?/+)'!/%-'4!4#!4I'$+G+$!*4!I#44+ '!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777!J! Use$the$root$operator$„~“!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!J! 0#/L+(@!?+)3!8/-4!?+)3#%)!G+-'!'M)'(4+#(!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!J! "+GG'/'($'4!.')?''(!<<N!*(6!O+4%*-!N)%6+#!0'."'H!N'/H'/!77777777777777777777777777777777777777777777777777777777777777777777!J! <(4)* *)+#(!#G!8/-9'?/+)+(@=')78/-9'?/+)'!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!P! NE4)'&!/'Q%+/'&'()4!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!P! <(4)* *)+#(!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!P! <(4)* *)+#(!#G!)3'!,44'& E77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!P! <(4)* *)+#(!#G!)3'!$#(G+@%/*)+#(!4$3'&*!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!P! N'))+(@!%I!)3'!$#(G+@%/*)+#(!4'))+(@4!*/'*!+(!)3'!0'.7$#(G+@!7777777777777777777777777777777777777777777777777777777777777!P! ;&.'66+(@!8/-9'?/+)+(@=')!*4!R))IK#6%-!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!S! ='$'44*/E!$3*(@'4!.E!%I@/*6+(@!G/#&!T7T!)#!B7U!777777777777777777777777777777777777777777777777777777777777777777777777777777777777!S! >+H'!E#%/!/%-'4!%(+Q%'!(*&'4!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!S! Remove$„compileRegEx“$attribute!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!S! 9'G/'43!$#(G+@%/*)+#(!4$3'&*!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!S! V#(G+@%/*)+#(!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!W! ,))/+.%)'4!G#/!X%/-/'?/+)+(@(')!YZ!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!W! 23'!!XI/#H+6'/4!YZ!-+4)+(@!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TU! 23'!X/'?/+)'4!YZ!-+4)+(@!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TU! 9'@;M!9'?/+)'!,))/+.%)'4!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TT! N'))+(@4!#(!)3'!?'.4'/H'/![<<N\!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TB! ,44+@(!#)3'/!G+-'!'M)'(4+#(4!?+)3!,NA7=;2!B7U777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TB! <<N!]7UY]7T!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TB! <<N!J7U!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TB! R*(6-'!* !/'Q%'4)4!.E!,NA7=;2!B7U!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TB! <<N!]7UY]7T!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TB! <<N!J7U!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TB! V3*(@+(@!#G!9'?/+)'!9%-'4!#(!/%()+&'!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!T^! V/'*)'!E#%/!#?(!9'?/+)'_9%-'_A/#H+6'/!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TD! "'H'-#I+(@!)3'!/'?/+)'!-#@+$!777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TD! V/'*)+#(!#G!*!('?!I/#H+6'/!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TJ! ;&.'66+(@!)3'!I/#H+6'/!+(!0'.7$#(G+@!7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TJ! V#IE/+@3)!(#)+$'!77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777!TP! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!^! & !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!D! What&is&UrlRewritingNet.UrlRewrite?& 8/-9'?/+)+(@=')78/-9'?/+)'!+4!*!%-'!?3+$3!$#%-6!.'!'&.'66'6!+(!*(!,NA7=;2!B7U!*II-+$*)+#(!)#! /'?/+)'!8/-4![<()'/(')!*66/'44'4\!G#/!6+4I-*E+(@!)3'!%4'/!*(#)3'/!89:!)3*(!%4'6!G/#&!)3'!4'/H'/7!0+)3! 8/-9'?/+)+(@=')78/-9'?/+)'!E#%!#(-E!3*H'!)#!6'G+('!*!G'?!4+&I-'!/%-'4!G#/!/'?/+)+(@!E#%/!*66/'44'47! Why&rewriting&my&Urls?& A$little$example.$You’re$developing$ #@!4#G)?*/'!?3+$3!4)#/'4!+)4!'()/+'4!+(!*!6*)*.*4'7!2#!@')!)3'!'()/E! G#/!6+4I-*E+(@!+)!+(!*!6')*+-4!I*@'!E#%!(''6!)3'!+6'()+)E![<"\!#G!)3'!/'$#/6!)#!6+4I-*E7!2#!@')!)3'!<"!E#%! %4%* E!)/*(4I#/)!)3+4!H*-%'!.E!`%'/E!N)/+(@a!3))IaYY&E #@7$#&Y6')*+-47*4IMC+6bB^D7! <G!E#%/! #@!+4!/'*6E!*(6!#(-+('!E#%!?*()!)#!.'!G#%(6!.E!I#)'()+*-!/'*6'/4!#(!4'*/$3!'(@+('4!-+L'!>##@-'! #/!c*3##7!23'4'!4'*/$3!'(@+('4!4'(6!.#)4!#%)!)#!)3'!0#/-6!0+6'!0'.!)#!G+(6!+()'/'4)+(@!$#()'()7!N#! ?3*)!6#!E#%!&'*(!?3*)!)3'!.#)!6#'4!?+)3!*!8/-!-+L'!43#?(!*.#H'C!=#)!&%$3d!/+@3)7! So,$wouldn’t$it$be$cooler$if$the$bot$could$find$the$topic$of$the$blog$entry$in$the$Url$for!'M*&I-'C!,! /'?/+))'(!8/-!$#%-6!-##L!-+L'!)3+4a!3))IaYY&E #@7$#&Y6')*+-Y@##6_('?4_G#/_*_.'))'/_?#/-6_B^D7*4IM7! 23'!&*$3+('![4'*/$3!'(@+('!.#)\!3*4!4#&')3+(@!)#!*(*-Ee'!*(6!)3'!%4'/!$*(!+&*@+('!?3*)!)3'!)#I+$!+4! *.#%)!#(!)3+4!I*@'d!)##7! Functions&of&UrlRewritingNet.UrlRewrite& 23'/'!*/'!4#&'!4#-%)+#(4!G#/!/'?/+)+(@!8/-4!?+)3!,NA7=;2d!.%)!)-E!)3'/'!*/'!4#&'!6+4*6H*()*@'4d!G#/! 'M*&I-'!&+44+(@!4%II#/)!G#/!23'&'4!*(6!K*4)'/!A*@'47!F#/!4#&'!E#%!(''6!,6&+(+4)/*)#/!/+@3)4!)#! +(4)* !*(!<N,A<!'M)'(4+#(!#(!)3'!4'/H'/7! This$isn’t$necessary$by$UrlRewritingNet.UrlRewrite$and$you$could$avoid$many$problems.! ♥ 9'?/+)+(@!8/-4!.*4'6!#(!/'@%-*/!'MI/'44+#(4! ♥ N%II#/)!G#/!23'&'4!!*(6!K*4)'/!A*@'4! ♥ N%II#/)!G#/!f%)I%)V*$3'+(@! ♥ 84'!+(!&'6+%&!)/%4)!-'H'-!'(H+/#(&'()4![43*/'6!3#4)+(@\!I#44+ '! ♥ V#(4+4)'()!8/-!*G)'/!I#4)!.*$L! ♥ ,66+(@!#?(!/'?/+)'!/%-'!I/#H+6'/4!I#44+ '! ♥ 9'6+/'$)4![*-4#!I'/&*('()\!)#!#)3'/!6#&*+(4!#/!?'.4+)'4!I#44+ '! ♥ N%II#/)!G#/!V##L+'!-'44!N'44+#(4! ♥ ,66+(@!/'?/+)'!/%-'4!#(!/%()+&'! ♥ O'/E!'*4E!+(4)* *)+#(!*(6!%4'! Limitations&of&UrlRewritingNet.UrlR ewrite& N#!&*(E!@##6!)3+(@4!3*H'!#G!$#%/4'!*!43*6E!4+6'd!)##7!5'$*%4'!#G!/'?/+)+(@!?+)3!)3'!7=;2!B7U!'(@+('! #(-E!/'Q%'4)4!$#&+(@!#H'/!,NA7=;2!B7U!$*(!.'!3*(6-'67!23+4!&'*(4!)3*)!)3'!G+-'!'M)'(4+#(!3*H'!)#!.'! 3*(6-'6!.E!,NA7=;2!B7U!<N,A<!-+./*/E![4''a!N'/H'/!N'))+(@4d!I*@'!TD\7!5E!6'G*%-)!)3+4!+4!G#/!'M*&I-'!7*4IM! –!.%)!+G!E#%!?*()!)#!/'?/+)'!?+)3!#)3'/!'M)'(4+#(4d!E#%!3*H'!)#!4')!)3+4!%I!.E!E#%/4'-G!#/!*4L!E#%/! ,6&+(+4)/*)#/!)#!6#!)3+47! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!]! F#/!)3+4!/'*4#(!)3'/'!+4!*-4#!(#!/'?/+)'!?+)3#%)!'M)'(4+#(!I#44+ '![G#/!'M*&I-'! 3))IaYY&E #@7$#&Y%4'/Y.+ \7!F#/!*!4#-%)+#(!G#/!)3+4!4I'$+*-!I/# '&!4''!I*@'!Jd!9'?/+)'!8/-4!?+)3#%)! G+-'!'M)'(4+#(7! We$are$also$sorry$to$tell$you,$that$„Cross$Page$Postings“$are$not$available$yet$without$disabling$security$ $3'$L47! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!J! Notable&things&by&developing&a&web&application& F#/!G*4)!4%$$'44!E#%!43#%-6!)*L'!*!-##L!*)!)3'!G# #?+(@!.*4+$47! Make&your&rewrite&rules&so&specific&as&possible& <G!E#%!&*L'!E#%/!/%-'4!(#)!4I'$+G+$!'(#%@3d!E#%!?+ !@'('/*)'!(#)!'MI'$)'6!'GG'$)47!F#/!'M*&I-'!E#%! *H#+6!*$$'44!#(!+&*@'4d!4)E-'!43'')4d!?'.!4'/H+$'4d!g*H*!4$/+I)4!#/!#)3'/!'-'&'()4!#(!)3'!4'/H'/7! N#!I-'*4'!4I'$+GE!Eour$rules$as$exactly$as$possible.$For$example$not$„^~/(.*)/(.*).aspx“.$Use$the$specific$ /'@%-*/!'MI/'44+#(!'-'&'()4!G#/!(%&.'/4!+G!E#%!*?*+)!(%&.'/4!*(6!(#!@'('/+$!I-*$'3#-6'/!*(6!4#!#(7! Use$the$root$operator$„~“& F#/!*$$'44!#(!/'4#%/$'4!+(!E#%/!?'.![G#/!'M*&I-'!+&*@'4d!4)E-'!43'')4!#/!g*H*!4$/+I)4\!*-?*E4!%4'!)3'! root$operator$„~“.$With$this$operator$every$path$will$build$correctly,$starting$from$the$applications$root.! 9+@3)! <asp:Image*ImageUrl=“~/images/pictures.gif*runat=“server“/>!! 0/#(@!!!"#$%&'"()*&'"(eUrl=“ / /images/pictures.gif“*runat=“server“/>* ! You$can$also$use$this$for$HtmlControls.$Just$add$runat=“server“$and$it$works.! <image*src=“~/images/pictures.gif“*runat=“server“/>7! If$the$head$tag$is$running$on$server$(runat=“server“)$you$can$leave$out$th'!/%(*)!*))/+.%)'!3'/'!G#/! h*H*N$/+I)!*(6!4)E-'!43'')!)*@4![*(6!#(-E!3'/'d!(#)!+(!)3'!.#6E!#G!)3'!6#$%&'()i\7! Working&with&Urls&without&file&extensio n& <G!E#%!?*()!)#!?#/L!?+)3!8/-4!?+)3#%)!G+-'!'M)'(4+#(!E#%!G+/4)!3*H'!)#!$#(G+@%/'!)3'!<<N![4''!I*@'!TDd! 4'))+(@4!#(!4'/H'/\! =#?!E#%!3*H'!6'G+('6!*!6'G*%-)!A*@'!+(!)3'!8/-/'?/+)+(@=')!$#(G+@%/*)+#(!4'$)+#(!+(!0'.7$#(G+@7!0+)3! )3*)!4'))+(@!/'Q%'4)4!#(!YG#-6'/Y!*/'!/'6+/'$)'6!)#!YG#-6'/Y6'G*%-)7*4IMd!+G!)3'!*))/+.%)'!+4!4')!)#! 6'G*%-)7*4IM!G#/!'M*&I-'7! 23+4!+4!('cessary$because$otherwise$ASP.NET$2.0$couldn’t$resolve$the$right$address$by$calling$ 9'4#-H'V-+'()8/-[\!&')3#6d!?3+$3!./+(@4!4#&'!G%((E!'GG'$)4!?+)3!23'&'4!G#/!'M*&I-'!?+)37! Important:$the$rewrite$rule$has$to$be$configured$to$handle$the$„default.aspx“$and$n#)!)3'!8/-!?+)3#%)! 'M)'(4+#(i! Differences&betwe en&IIS&and&Visual&Studio&WebDev&Server& 8/-9'?/+)+(@=')!+4!?#/L+(@!?+)3!<<N![<()'/(')!<(G#/&*)+#(!N'/H+$'4\!*4!?' !?+)3!)3'!O+4%*-!N)%6+#!BUU]! .%+-)!+(!?'.!4'/H'/7!5%)!)3'/'!+4!*!-+))-'!6+GG'/'($'7! 23'!0'."'H!N'/H'/!I*44'4!'H'/E![i\!/'Q%'4)!)3/#%@3!,NA7=;2!–!IIS$don’t.! This$is$important$if$you$want$to$use$extensions$like$.html,$.php,$xml$or$other$for$example,$or$if$you’re$ working$without$file$extensions.$The$built$in$server$does$handle$this$„correctly“,$the$IIS!3*4!)#!.'!4')!%I! .'G#/'!@'))+(@!)3+4!/%((+(@!#(!+)7!<(!#%/!#I+(+#(!)3'!.'4)!?*E!)#!)'4)!+4!)#!%4'!)3'!<<N!*-4#!#(!)3'! 6'H'-#I&'()!&*$3+('7! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!P! Installation&of&UrlRewritingNet.UrlRewrite& System&requirem ents& 8/-9'?/+)+(@=')78/-9'?/+)'!+4!/%((+(@!#(!'*$3!0'.!4'/H'/!?3+$3!+4!/%((+(@!,NA7=;2!B7U7! 2'4)'6!0'.!4'/H'/!?+)3!8/-9'?/+)+(@=')78/-9'?/+)'a! ♥ <<N!]7U! ♥ <<N!]7T! ♥ <<N!J7U! ♥ O+4%*-!N)%6+#!BUU]!0'."'H!N'/H'/! We$didn’t$test$it$with$Mono.! Installation& 2#!+(4)* !8/-9'?/+)+(@=')78/-9'?/+)'!E#%!3*H'!)#!G# #?!)3'4'!'*4E!4)'I4a! T7 <(4)* *)+#(!#G!)3'!,44'& E!(„.dll“)! B7 <(4)* *)+#(!#G!)3'!$#(G+@%/*)+#(!4$3'&*! ^7 N'))+(@!%I!)3'!$#(G+@%/*)+#(!4'))+(@4!*/'*!+(!)3'!0'.7$#(G+@! D7 ;&.'66+(@!8/-9'?/+)+(@=')!*4!R))I!K#6%-'! Installation&of&the&Assembly& h%4)!$#IE!UrlRewritingNet.UrlRewriter.dll!+(!E#%/!?'.!*II-+$*)+#(4!Y.+(!G#-6'/7! Installation&of&the&configuration&schema& 2#!@')!<()' +N'(4'!4%II#/)!g%4)!$#IE!)3'!G+-'!%/-?/+)+(@(')7M46!+(!E#%!?'.!*II-+$*)+#(![?3'/'H'/!E#%! ?*()\7!<G!E#%!?'.!*II-+$*)+#(!+4!I*/)!#G!*!4#-%)+#(d!E#%!$*(!*-4#!I%)!)3'!G+-'!*(E?3'/'!+(!)3'!4#-%)+#(7! Setting&up&the&configuration&settings&area&in&the&Web.config& 2#!@')!)3'!$#(G+@%/*)+#(!4'))+(@4!G/#&!)3'!?'.7$#(G+@!)3+4!*/'*!3*4!)#!.'!*6H'/)+4'67!h%4)!/'I-*$'!)3'! X$#(G+@N'$)+#(4Z!+G!'M+4)47! !+, /(01"2/,-3* **!+, /(4)+2/,-#3* ****!#)+2/,-*-"')560171)81/ 2/-(-)26*** *************1)#2"129-:;2)1-"7<="-()#56210)6* *************1)>0/1)?)1'/##/,- *56."7#)6** *************2@$)56A17B)81/2/-(C)2D<, /(01"2/,-DA17B)81/2)4)+2/,-E* *******************A17B)81/2/-(C)2DA17B)81/2)16**F3* **!F+, /(4)+2/,-#3* !F+, /(01"2/,-3* <G!)3'!*/'*!+4!*6H'/)+4'6d!g%4)!$/'*)'!+)7! **!0171)81/2/-(-)2* ******;'7-#56=22$%FF888D01 71)81/2/-(D-)2F#+=)'"#F+, /(FGHHIF HJ6*3* **!F0171)81/2/-(-)23* 23+4!4'$)+#(!3*4!)#!.'!I-*$'6!+(!X$#(G+@%/*)+#(!YZ!.%)!*G)'/!X$#(G+@N'$)+#(4!YZ7!"#!(#)!I-*$'!)3+4!+(! X*IIN'))+(@4!YZ!#/!X4E4)'&7?'.Zi!F#!'M*&I-'!4'!)3'!4*&I-'!?'.!*II-+$*)+#(7!2#!@')!<()' +N'(4'! support$you$have$to$add$the$„xmlns“$attribute.! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!S! Embedding&UrlRewritingNet&as&HttpModul& 2#!3*(6-'!* !+($#&+(@!/'Q%'4)4!?+)3!8/-9'?/+)+(@=')!E#%!3*H'!)#!/'@+4)'/!)3'!$#&I#('()!*4!R))I! K#6%-'!+(!)3'!X4E4)'&7?'.!YZ!4'$)+#(!+(!0'.7$#(G+@7! **!#@#2)'D8)K3* ****!=22$L,M07)#3* *****!"MM*-"')56A 17B)81/2)L,M07)6* *********2@$)56A17B)81/2/-(C)2DN)KDA17B)81/2)L,M07)E*A17B)81/2/-(C)2DA17B)81/2)16*F3* ****!F=22$L,M07)#3***** **!F#@#2)'D8)K3* =#?!8/-9'?/+)+(@=')!$#(G+@%/*)+#(!+4!$#&I-')'7! Necessary&changes&by&upgrading&from&1.1&to&2.0& 5E!%I@/*6+(@!G/#&!T7T!)#!B7U!E#%!3*H'!)#!$3*(@'!*!-+))-'!.+)!#(!E#%/!'M+4)+(@!$#(G+@%/*)+#(7! T7 , !/%-'4!(''6!*!%(+Q%'!(*&'7! B7 Don’t$use$the$attribute$„compileRegEx“$anymore.! ^7 9'G/'43!$#(G+@%/*)+#(!4$3'&*! <G!#('!#G!)3'4'!/'Q%+/'&'()4!+4!(#)!@+H'(d!)3'!*II-+$*)+#(!)3/#?4!'M$'I)+#(47! Give&your&rules&unique&names& , !'M+4)+(@![*(6!#G!$#%/4'!('?\!/%-'4!3*H'!)#!@')!%(+Q%'!(*&'47!23+4!+4!('$'44*/E!)#!$3*(@'!)3'&!#(! /%()+&'7! f-6!/%-'!'()/Ea! ******!"MM*O/120"7A1756PQF(/17#FRDSTFRDSTD"#$;6************* ***********1)81/2)A17?"1"')2)1 56:;+70M)U1,'<7/)-2V0)1@421/-(6** ***********M)#2/-"2/,-A1756QFW)."072D"#$;X-"')5YZ["'$\#=,85YG6* ***********/(-,1)<"#)56210)6*F3* * ='?!/%-'!'()/Ea! ******!"MM*-"')56]"77)1@6*** ***********O/120"7A1756PQF(/1 7#FRDSTFRDSTD"#$;6************* ***********1)81/2)A17?"1"')2)1 56:;+70M)U1,'<7/)-2V0)1@421/-(6** ***********M)#2/-"2/,-A1756QFW)."072D"#$;X-"')5YZ["'$\#=,85YG6* ***********/(-,1)<"#)56210)6*F3* Remove&„compileRegEx“$attribute& The$attribute$„compileRegEx“$has$become$#.4#-')'7!N#!I-'*4'!/'&#H'!+)!G/#&!* !'()/+'4!*(6!)3'! !0171)81/2/-(-)2*F3!!$#(G+@%/*)+#(!*/'*7! Refresh&configuration&schema& F#/!@'))+(@!<()' +N'(4'!4%II#/)!E#%!3*H'!)#!%I6*)'!)3'!(*&'4I*$'!)#!)3'!$%//'()!H'/4+#(7! **!0171)81/2/-(-)2* ****;'7-#56=22$%F F888D0171)81/2/-(D-)2F#+=)'"#F+, /(FG HHIFHJ6*3! ,(6!#G!$#%/4'!E#%!3*H'!)#!/'I-*$'!)3'!'M+4)+(@!%/-/'?/+)+(@(')7M46!?+)3!)3'!('?!#('7! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!W! Configuration& H#(!8/-9'?/+)+(@=')78/-9'?/+)'!+4!$#(G+@%/'6!+(!)3'!*/'*!+(!0'.7$#(G+@!?3+$3!E#%!4')!%I!6%/+(@!)3'! +(4)* *)+#(![4''!I*@'!S\7! R'/'!*!-+))-'!4*&I-'a! **!0171)81/2/-(-)2* ****1)81/2)9-7@^/120"7A17#56210)6**** ****+,-2);2&2)'#?1)./;56V0)1@421/-(6** ****M)."072?"()*5*6M)."072D"#$;6* ****;'7-#56=22$%F F888D0171)81/2/-(D-)2F#+=)'"#F+, /(FG HHIFHJ6*3* ****!$1,O/M)1#3* ******!"MM*-"')56L@]1)"2?1,O/M)16*2@$)56L@_$$DN)KDL@]1)"2?1,O/M)1E* L@]1)"2?1,O/M)1DM776F3* ****!F$1,O/M)1#3* ****!1)81/2)#3* ******!"MM*-"')56B07)Z6**O/120"7A1756PQFRDSTFW)2"/7RDSTD"#$;6************* ***********1)81/2)A17?"1"')2)1 56:;+70M)U1,'<7/)-2V0)1@421/-(6** ***********M)#2/-"2/,-A1756QFW)."072D"#$;X7"-(0"()5YZ["'$\/M5YG6* ***********/(-,1)<"#)56210)6*F3* ******!"MM*-"')56B07)G6*** ***********$1,O/M)156L@]1)"2?1,O/M)16* ***********'@"221/K02)56F.,,FK"1FM=/-D"#$;6** ***********1)81/2)A17?"1"')2)1 56:;+70M)U1,'<7/)-2V0)1@421/-(6** ***********1)81/2)56W,'"/-6** ***********/(-,1)<"#)56210)6*F3* ****!F1)81/2)#3* **!F0171)81/2/-(-)23* 23+4!$#(G+@%/*)+#(!$*(!.'$#&'!H'/E!$#&I/'3'(4+H'd!4#!E#%!$*(!4?*I!+)!#%)!+()#!*(!'M)'/(*-!$#(G+@!G+-'7! A-'*4'!%4'!)3'!$#(G+@N#%/$'!*))/+.%)'!G#/!)3*)a! **!0171)81/2/-(-)2*+, /(4,01+)5 6:;2)1-"7B)81/2)D+, /(6*F3* <(!;M)'/(*-9'?/+)'7$#(G+@!E#%!3*H'!)#!I%)!)3'!$#&I-')'!$#(G+@%/*)+#(!*/'*7! Attributes&for&<urlrewritingnet&/>& & rewriteOnlyVirtualUrls! true,0false0(Standard:0true)! A/'H'()4!/'?/+)+(@!G#/!/'*-!'M+4)+(@!G+-'4!#(!)3'!4'/H'/!+G!true7! contextItemsPrefix! String! <G!)3'!`%'/E!N)/+(@!I*/*&')'/4!43#%-6!I%))'6!6#?(!+(!HttpContext.Current.Items[],0E#%! $*(!6'G+('!*!I/'G+Md!?3+$3!?+ !.'!+(4'/)'6!.'G#/'!)3'!I*/*&')'/4!(*&'!?+)3!*!I#+()! *G)'/7!! defaultProvider! ProviderName0(Standard:0RegEx)! =*&'!#G!)3'!6'G*%-)!9'?/+)'!A/#H+6'/!%4'6!+G!(#!#)3'/!+4!*44+@('67! !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!TU! defaultPage! Dateiname! =*&'!#G!)3'!6'G*%-)!I*@'!?3+$3!+4!%4'6!#(!*$$'44!?+)3#%)!G+-'!'M)'(4+#(![4''!I*@'!Jd! ?#/L+(@!?+)3#%)!G+-'!'M)'(4+#(\7! The&&<providers&/>&listing& R'/'!$*(!)3'!$%4)#&!I/#H+6'/4!.'!*66'67!F#/'!&#/'!+(G#/&*)+#(!see$page$19$„Embedding$the$provider$ in$the$Web.config“$and$the$documentation$of$the$specific$provider.! The&<rewrites&/>&listing& R'/'!$*(!)3'!/'?/+)'!/%-'4!.'!*66'67!23'!/%-'4!*/'!I/#$'44'6!G/#&!%I!)#!6#?(d!)3'!G+/4)!&*)$3+(@!/%-'!+4! %4'6!G#/!)3'!/'?/+)+(@!*(6!)3'!I/#$'44!+4!.'+(@!/'*6E![(#!&#/'!/%-'!?+ !.'!I/#$'44'6\7! 2#!*66!*!('?!/%-'!g%4)!)EI'!*!('?!X*66!YZ!'-'&'()d!<()' +N'(4'!?+ !I/'4'()!E#%!)3'!*H*+-* '!*))/+.%)'4! ?3+$3!*/'!-+4)'6!.'-#?7! name! Name0of0the0rule0 ,!G/''!4'-'$)* '!(*&'!#G!)3'!/%-'!?3+$3!3*4!)#!.'!%(+Q%'7!0+)3!)3+4!(*&'![<"\!E#%!$*(! 6#!4#&'!&*@+$!?+)3!)3+4!/%-'!I/#@/*&&*)+$* Ed!)##![4''!I*@'!TJ\! 9provider! ProviderName0! =*&'!#G!)3'!%4'6!I/#H+6'/7!<G!(#!#('!+4!4'-'$)'6d!)3'!6'G*%-)!I/#H+6'/!?+ !.'!%4'67! redirect! None,0Application,0Domain0(Standard:0None)! 2#!&*L'!*!/'6+/'$)!+(4)'*6!#G!*!/'?/+)'7! None! ! =#/&*-!/'?/+)'! Application!! 9'6+/'$)!?+)3+(!E#%/!?'.!*II-+$*)+#(! Domain!! 9'6+/'$)!)#!*(#)3'/!6#&*+(!?3+$3!3*4!)#!.'!I*/)!#G!)3'!6'4)+(*)+#(8/-! redirectMode! Permanent,0Temporary0(Standard:0Temporary)! R'/'!E#%!$*(!4'-'$)!#G!?3+$3!)EI'!E#%/!/'6+/'$)!+4!–!I'/&*('()![R22A!4)*)%4!$#6'!^UT\! #/!)'&I#/*/E![R22A!4)*)%4!$#6'!^UB\7!<G!E#%!?*()!)#!)/*(4G'/!*!?'.4+)'!G/#&!#('! domain$to$another$permanently$use$„Permanent“.! rewrite9 Application,0Domain0(Standard:0Application)! "'G+('4!?3')3'/!)3'!6#&*+(!3*4!)#!.'!+($-%6'6!+(!)3'!I/#$'44!#/!(#)7! rewriteUrlParameter9 ExcludeFromClientQueryString,0StoreInContextItems!d!IncludeQueryStringForRewrite0 (Standard:0ExcludeFromClientQueryString)0 0 ExluceFromClientQueryString0 <(!Request.QueryString[]!* !I*/*&')'/4!*/'!*H*+-* '7!<(!Page.ClientQueryString!*/'!#(-E! [...]... this.VirtualUrl = rewriteSettings.GetAttribute("virtualUrl", ""); this.destinationUrl = rewriteSettings.GetAttribute("destinationUrl", ""); } private void CreateRegEx() { UrlHelper urlHelper = new UrlHelper(); if (IgnoreCase) { this.regex = new Regex(urlHelper.HandleRootOperator(virtualUrl), RegexOptions.IgnoreCase | RegexOptions.Compiled | regexOptions); ... } } public override bool IsRewrite(string requestUrl) { return this.regex.IsMatch(requestUrl); } public override string RewriteUrl(string url) { return this.regex.Replace (url, this.destinationUrl, 1); } } www.urlrewriting.net Page 15 Creation of a new provider The only job of the provider is to instantiate an object of your own RewriteRule class. Additional logic ... this.regex = new Regex(urlHelper.HandleRootOperator(virtualUrl), RegexOptions.Compiled | regexOptions); } } private string virtualUrl = string.Empty; public string VirtualUrl { get { return virtualUrl; } set { virtualUrl = value; CreateRegEx(); ... RegExRewriteRule rule = new RegExRewriteRule(); rule.VirtualUrl = "^~/abteilung/(.*)/default.aspx"; rule.DestinationUrl = "~/showabteilung.aspx?abteilgun=$1"; rule.IgnoreCase = true; rule.Rewrite = RewriteOption.Application; rule.Redirect = RedirectOption.None; rule.RewriteUrlParameter = RewriteUrlParameterOption.ExcludeFromClientQueryString; UrlRewriting.AddRewriteRule("AbteilungsRegel", rule); UrlRewriting.RemoveRewriteRule("AbteilungsRegel"); ... RewriteSettings offers helper methods for doing this. public override bool IsRewrite(string requestUrl); Here you should shortly test if the URL passes into your rewrite schema (return true;) or not (return false;), nothing more if possible. public override string RewriteUrl(string Url) Here you have to implement the magic which makes the physical Url from the virtual one. As return value it awaits the “real” address. Consider whether it was a domain rewrite or an application redirect ... „c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll“. Do not check „verify that file exists“! www.urlrewriting.net Page 12 Changing of Rewrite Rules on runtime For changing the rewrite rules on runtime UrlRewritingNet.UrlRewrite offers four static methods: namespace UrlRewritingNet.Web { static public class UrlRewriting { public static void AddRewriteRule(string ruleName, RewriteRule rewriteRule); ... virtualUrl="^~/girls/(.*)/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Default.aspx?name=$1&show=$2" ignoreCase="true" /> ... As a developer of a rewrite provider you should look to develop your provider meeting the standard behavior, but of course – it can vary. RegEx Rewrite Attributes Our standard provider has the following attributes. virtualUrl regular expression A regular expression which is used for replacing the current Url with destinationUrl. destinationUrl regular expression replacement term A regular expression term describing the target page (physical file). regexOptions Multiline, ExplicitCapture, Singleline, IgnorePatternWhitespace, RightToLeft, ... The only job of the provider is to instantiate an object of your own RewriteRule class. Additional logic isn’t necessary. Your own provider has to be based on class UrlRewritingRuleProvider and has to implement only one method. Here a complete class: public class RegExUrlRewritingProvider : UrlRewritingProvider { public override UrlRewritingNet.Web.RewriteRule CreateRewriteRule() { return new RegExRewriteRule(); ... virtualUrl = value; CreateRegEx(); } } private string destinationUrl = string.Empty; public string DestinationUrl { get { return destinationUrl; } set { destinationUrl = value; } } private RegexOptions regexOptions = RegexOptions.None; public RegexOptions RegexOptions . #?+(@!*))/+.%)'47! virtualUrl! regular0expression! ,!/'@%-*/!'MI/'44+#(!?3+$3!+4!%4'6!G#/!/'I-*$+(@!)3'!$%//'()!8/-!?+)3!destinationUrl70 destinationUrl! regular0expression0replacement0term! ,!/'@%-*/!'MI/'44+#(!)'/&!6'4$/+.+(@!)3'!)*/@')!I*@'![I3E4+$*-!G+-'7! regexOptions0 Multiline,0ExplicitCapture,0Singleline,0IgnorePatternWhitespace,0RightToLeft,0 ECMAScript,0CultureInvariant! F#/!*(!#I)+&*-!$#()/#-!#H'/!)3'!/'@%-*/!'MI/'44+#(4!E#%!$*(!*66!*66+)+#(*-!)#! ignoreCase!3'/'!4#&'!RegexOptions7!5%)!)3+4!+4!#(-E!('$'44*/E!+(!4I'$+*-!$*4'47!F#/! &#/'!+(G#/&*)+#(!4''!)3'!K+$/#4#G)!KN"=!6#$%&'()*)+#(7! ! !! ?. ! ! A*@'!!^! & !! ? ? ? 7 % / - / ' ? / + ) + ( @ 7 ( ' ) ! ! A*@'!!D! What&is&UrlRewritingNet.UrlRewrite?& 8/-9'?/+)+(@=')78/-9'?/+)'!+4!*!%-'!?3+$3!$#%-6!.'!'&.'66'6!+(!*(!,NA7=;2!B7U!*II-+$*)+#(!)#! /'?/+)'!8/-4![<()'/(')!*66/'44'4!G#/!6+4I-*E+(@!)3'!%4'/!*(#)3'/!89:!)3*(!%4'6!G/#&!)3'!4'/H'/7!0+)3! 8/-9'?/+)+(@=')78/-9'?/+)'!E#%!#(-E!3*H'!)#!6'G+('!*!G'?!4+&I-'!/%-'4!G#/!/'?/+)+(@!E#%/!*66/'44'47! Why&rewriting&my&Urls?& A$little$example.$You’re$developing$. #@7$#&Y6')*+-Y@##6_('?4_G#/_*_.'))'/_?#/-6_B^D7*4IM7! 23'!&*$3+('![4'*/$3!'(@+('!.#)!3*4!4#&')3+(@!)#!*(*-Ee'!*(6!)3'!%4'/!$*(!+&*@+('!?3*)!)3'!)#I+$!+4! *.#%)!#(!)3+4!I*@'d!)##7! Functions&of&UrlRewritingNet.UrlRewrite& 23'/'!*/'!4#&'!4#-%)+#(4!G#/!/'?/+)+(@!8/-4!?+)3!,NA7=;2d!.%)!)-E!)3'/'!*/'!4#&'!6+4*6H*()*@'4d!G#/! 'M*&I-'!&+44+(@!4%II#/)!G#/!23'&'4!*(6!K*4)'/!A*@'47!F#/!4#&'!E#%!(''6!,6&+(+4)/*)#/!/+@3)4!)#! +(4)*