MVC Routing question

Discussion in 'ASP .Net' started by Matthias S., Sep 15, 2008.

  1. Matthias S.

    Matthias S. Guest

    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., Sep 15, 2008
    #1
    1. Advertising

  2. Matthias S.

    bruce barker Guest

    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
    > --
    >
    >
     
    bruce barker, Sep 15, 2008
    #2
    1. Advertising

  3. Matthias S.

    Matthias S. Guest

    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
    > > --
    > >
    > >
     
    Matthias S., Sep 16, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Heliboy

    Xilinx FPGA routing question

    Heliboy, Jul 6, 2004, in forum: VHDL
    Replies:
    1
    Views:
    650
    Kelvin
    Jul 6, 2004
  2. rmn190
    Replies:
    2
    Views:
    2,427
    Arne Vajhøj
    Jan 10, 2008
  3. Paulo
    Replies:
    3
    Views:
    501
    Peter Bromberg [C# MVP]
    Dec 4, 2008
  4. weijie.zhang
    Replies:
    2
    Views:
    329
    weijie.zhang
    Feb 5, 2009
  5. Crazy Cat
    Replies:
    1
    Views:
    713
    schepp
    Sep 3, 2009
Loading...

Share This Page