London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Url Rewriter for pagination

Vote:
 

I am having a technical difficulty implementing pagination for a blog which is rewriting the url.  I can actually get it to rewrite the url as such:
"/Views/Pages/Blog?pageIndex=2" -> "/Blog/2"  but when i actually click on teh link, I am getting the nasty 404 error.  Is there something i am missing?  I am using EPiServer 7 Webforms.  Could someone guid me in the right direction?

#77339
Nov 17, 2013 7:09
Vote:
 

Are you sure the URLs and requests are the same? (both are GET requests, there´s no ending / in the URL etc).

Frederik

#77352
Nov 17, 2013 18:16
Vote:
 

I am not sure Frederik.  When i hover over the links, i get the right url, but when i click on it, i get the 404.  So i assume the url rewrite is working.   I am not as familiar with url rewriting as most people are, I will be the first to admit.  I never really had to use it. 

#77354
Nov 17, 2013 19:30
Vote:
 

The easiest would be to use a proxy tool like Fiddler to check both requests and inspect them. There has to be a difference between them,

Frederik

#77355
Nov 17, 2013 20:38
Vote:
 

Hey Frederik, I know you're a busy man, do you have a sample of a friendly url rewriter.  All i am really trying to accomplish is is to remove the &pageIndex=2 to respect /xxxx/2  and have episerver recognize that there is a querystring of pageIndex.  If not, I totally understand.  I have been trying everything.  I have charles proxy running but as soon as I click "/blog/2"  it instantly redirects to 404 page.  The header show 404.  I apologize for my ignorance on the urlrewriter.

#77356
Nov 17, 2013 20:47
Vote:
 

There's been a similar thread in the past that does almost the same thing you need: http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=77088&epslanguage=en.

And the code: https://gist.github.com/simplyio/7180218#file-z-routeconfig-cs

You can simplify it more since you only need the paging and not the product.

Frederik

#77357
Edited, Nov 17, 2013 20:59
Vote:
 

Thanks man.  It is much appreaciate.  I have looked all over and found most of the rewriting articles are for 6r2 or 6 which i know they are handled differently now.  Thanks again frederik.

#77358
Nov 17, 2013 21:02
Vote:
 

I think i spoke too soon.  Question, i know routes in global are used for mvc but does webforms hook into that in episerver for paths, or do i have to extend the friendly rewrite provider.  The cross over is a bit of a blurred line for me

#77528
Nov 20, 2013 17:12
Vote:
 

Regarding CMS 7 and frindly URL rewriter, this is a good article to read!

http://world.episerver.com/Blogs/Johan-Bjornfot/Dates1/2012/10/EPiServer7--Routing/

#77531
Nov 20, 2013 17:43
Vote:
 

I think i have it working 90%.  I have the url rewriting working and the routes working but wondering why i cannot see the values in the request.querystring params.  I am offically confused.  my url is as follows

http://xxx.com/blog/page/4/category/joshua/
my route is as follows

RouteTable.Routes.MapContentRoute(
                    name: "BlogPageAndCategory",
                    url: "/{node}/page/{pageIndex}/category/{category}",
                    defaults: new
                    {
                        pageIndex = UrlParameter.Optional,
                        category = UrlParameter.Optional
                    });

   

  BlogPageAndCategory  
Placeholder (Default)Actual
pageIndex ("") --
category ("") --
Parameter NameConstraintIs Match
action Castle.Proxies.IRouteConstraintProxy --
 
#77539
Nov 20, 2013 21:17
Vote:
 

above is from glimpse showing both my params are blank

#77540
Nov 20, 2013 21:18
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.