Last post Feb 23, 2010 01:05 PM by feiyim
Feb 21, 2010 09:12 AM|feiyim|LINK
Hey guys, how u doin? hop u are all aiight....
I have a problem with trying to rewrite my url to another format.......
I have configured my Intelligencia.UrlRewriter.dll in my Bin folder.....i want to then rewrite my URL from one format to another
~/ERP/StudentDetails.aspx?RegNo=107-063061-00055 to ~/ERP/StudentDetails.aspx/107-063061-00055.aspx or to another suitable format.
Can anyone tell me how to go about it?
Feb 21, 2010 12:42 PM|anzer|LINK
Its pretty easy to do URL Rewriting using Intelligencia.UrlRewriter..
You need to configure the reqriter properly in web.config after adding refernce to the DLL in your bin folder using Add Reference option in the VS solution explorer..
Foloow the steps here to make the configuration
The step 6 is the configuration of URL patterns.. here you need to set the pattern as you want..
You can try the pattern as follows to meet your need
<rewriter><rewrite url="/StudentDetails/(.+).aspx" to="/StudentDetails.aspx?RegNo=$1" /></rewriter>
Feb 21, 2010 03:36 PM|feiyim|LINK
Hello...how u doin....thks for the reply.......av really tried to implement what you wrote but all in vain. Can you please send me a zipped file with the implementation so i see exactly what to apply where.....am kinda confused....av tried to learn about
Regular expressions but all in vain......i want to really learn soo mch about this URL Rewriting so that i apply to in my security platform....
i'l be very happy if you can do this for me
Feb 21, 2010 04:45 PM|feiyim|LINK
Hi...i have applied the rewrites as you wrote them but still nothing changes to my URL. They still exist wit the old format as in
~/ERP/StudentDetails.aspx/RegNo=107-063061-00055. What do you think am missing......u have applied the following to my web.config
<section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
<rewrite url="^/tags/(.+)" to="/tagcloud.aspx?tag=$1" />
<rewrite url="/StudentDetails/(.+).aspx" to="/StudentDetails.aspx?RegNo=$1" />
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter" />
av also added the following dll to my Bin folder : Intelligencia.UrlRewriter.dll
Then can someone please tell me why my URL are not getting rewritten?
Feb 22, 2010 12:01 AM|anzer|LINK
If I understand correctly,, you made all the settings but trying to browse with the old URL itself..
URL Rewriting does not mean a url will get rewrite to something else automatically.. but what it means is a (rewrited) url will work as the orginal url when you try to browse...
If you have a URL http://www.yoursite.com/ERP/StudentDetails.aspx?RegNo=107-063061-00055 and if it work properly..
try the following url (after making all the correct configuration settings - that you already did I think)
It will work perfectly if you understand what is url rewriting and if you make the settings proper.. I have used the same URL rewriter for some huge projects like http://www.nestle-family.com/english/
If you click on any of the Healthy Living articles shown in the middle part or any of the recipe thumbnails shown in the left part.. you will see a rewrited SEO friendly url..
Feb 22, 2010 12:04 AM|anzer|LINK
Also please note that the follwing line in the configuration can be removed
<rewrite url="^/tags/(.+)" to="/tagcloud.aspx?tag=$1" />
they just added it for demonstration in the document.. you need the next line.. which is actually doing the pattern matching in your project. You can add more patterns also..
Feb 22, 2010 01:10 AM|feiyim|LINK
hi guys.....thnks a lot.....it really worked perfectly well.....am soo happy.......but what will make me more happy is that i wouldn't like people to access the resources of my ~/StudentDetails.aspx page using the old URL......
i want to show the new rewritten URL even when someone hovers on that link.....i want it to show
~/ERP/StudentDetails/107-063061-00055.aspx instead of ~/ERP/StudentDetails.aspx?RegNo=107-063061-00055
So basically, i dnt want people to know the details of that link so even if they hover on it from another page, they get the rewritten URL shown and not the old one
Feb 22, 2010 02:45 AM|anzer|LINK
Great to know you got it working..
Now you need to rework on all the pages where you showing URLs. You need to change all the old pattern urls to new urls.
If you check the view source of Nestle site I send to you, you can see we are showing the rewrited urls, so that the user will never know what the orginal url working in the background..
It may be a big task in an existing project, but you need to do it if you want the users use the friendly urls..
Feb 22, 2010 03:26 AM|feiyim|LINK
Hey..thanks....i loved nestle-family website....it really looks soo juicy.....felt thirsty when i visited it.....
Anyways.....i really thnk you guys for all the knowledge u are giving me...But i never undestood how to really implement wat i require...dnt knw if am using the wrong english to elaborate myself.
I tried to browse my server with the New URL (Rewritten URL) and i got the page i requested and that was
~/ERP/StudentDetails/107-063061-00055.aspx. But when am going through my links and fall hover onto that link especially from a GridView, i get the Old URL displaying in the Status bar of my browser....when i click onto that link furthermore, i get the old
URL and not the new URL in the Address Bar.
So how can i ensure that all the links that Map to the Old URL are actually turned into the New URL....its true i dnt want the OLD URL to appear anywhere. How can i make the Old URL vanish completly and it will be known to only me.
Feb 23, 2010 05:06 AM|anzer|LINK
Yes I well undestood the question..
What I am trying to tell is you need to change the menu links to the new pattern..
if you have a menu with link like following
<a runat="server" href="~/ERP/StudentDetails.aspx?RegNo=107-063061-00055">TEST</a>
you need to change it like following
<a runat="server" href="~/ERP/StudentDetails/107-063061-00055.aspx">TEST</a>
If you are dynamically generating your menu links, you need to re-write the program to out put the links in the new pattern...
Feb 23, 2010 01:05 PM|feiyim|LINK
Thanx man.....the stuff really worked for me....am so damn happy.....Long live ASP.NET....av marked as answered.....u really deserver those points