Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   MVC Routing question (http://www.velocityreviews.com/forums/t635445-mvc-routing-question.html)

Matthias S. 09-15-2008 04:41 PM

MVC Routing question
 
Hi there,

I'm going to develop my first application (blog type of thing) using
MVC. Now I have a question about routing. I'd like to implement a
globalization pattern like this:

http://mydomain/en/about (for the english about page)
and
http://mydomain/de/about (for the german about page)

The language code (in the above case 'en' or 'de') should be persisted
to a cookie. Whenever a page is called which doesn't have the language
portion in the URL, I want to lookup the value in the cookie. If there
is no cookie, I'd like to lookup the language supported by the browser
and rebuild the url. After that, I'd write the cookie.

How would I set up routing for a scenario like this?

Thanks in advance!

Matthias
--


bruce barker 09-15-2008 07:38 PM

RE: MVC Routing question
 
just supply a custom MvcRouteHandler

-- bruce (sqlwork.com)


"Matthias S." wrote:

> Hi there,
>
> I'm going to develop my first application (blog type of thing) using
> MVC. Now I have a question about routing. I'd like to implement a
> globalization pattern like this:
>
> http://mydomain/en/about (for the english about page)
> and
> http://mydomain/de/about (for the german about page)
>
> The language code (in the above case 'en' or 'de') should be persisted
> to a cookie. Whenever a page is called which doesn't have the language
> portion in the URL, I want to lookup the value in the cookie. If there
> is no cookie, I'd like to lookup the language supported by the browser
> and rebuild the url. After that, I'd write the cookie.
>
> How would I set up routing for a scenario like this?
>
> Thanks in advance!
>
> Matthias
> --
>
>


Matthias S. 09-16-2008 09:42 AM

Re: MVC Routing question
 
Hi Bruce,

thanks for your reply. I've been googeling but recources on how to
provide a custom MvcRouteHandler seem to be pretty little around. Could
you recommend some further reading?

Thanks again,

Matthias
--



bruce barker wrote:

> just supply a custom MvcRouteHandler
>
> -- bruce (sqlwork.com)
>
>
> "Matthias S." wrote:
>
> > Hi there,
> >
> > I'm going to develop my first application (blog type of thing) using
> > MVC. Now I have a question about routing. I'd like to implement a
> > globalization pattern like this:
> >
> > http://mydomain/en/about (for the english about page)
> > and
> > http://mydomain/de/about (for the german about page)
> >
> > The language code (in the above case 'en' or 'de') should be
> > persisted to a cookie. Whenever a page is called which doesn't have
> > the language portion in the URL, I want to lookup the value in the
> > cookie. If there is no cookie, I'd like to lookup the language
> > supported by the browser and rebuild the url. After that, I'd write
> > the cookie.
> >
> > How would I set up routing for a scenario like this?
> >
> > Thanks in advance!
> >
> > Matthias
> > --
> >
> >



All times are GMT. The time now is 06:03 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.