Oh, right. I just didn't find the PageHandlerFactory in my hurry (site was
online but only giving an error).My solution is somewhat more blunt so I'll
update it to yours tomorrow:

<httphandlers>
      <add verb="*" path="/default.aspx"
type="ImagineClub.Web.RedirectionHandler, ImagineClubWeb"/>
      <add verb="*" path="*.aspx"
type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,
Castle.MonoRail.Framework"/>
</httphandlers>

and the RedirectionHandler looked like this:

public class RedirectionHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.Redirect("/Home/Index.aspx");
        }

        public bool IsReusable
        {
            get { return true; }
        }
    }

Only thing that bit me on this how IIS6 works with it's default document.
You NEED to have a Default.aspx in that folder, although it won't ever be
served. IIS will not forward to the default document if it's not present on
disk (that's why MVC is having that blank Default.aspx lying in the root).

greetings Daniel

On Thu, Oct 15, 2009 at 11:05 PM, John Simons <[email protected]>wrote:

>
> Daniel,
>
> I thought there was a way of configuring IIS to by default go to a
> certain url.
> Anyway, I haven't tested this but in theory should work, have you
> tried to configure httpHandlers so that:
>
>   <httpHandlers>
>      <add path="*.vm" verb="*" type="System.Web.HttpForbiddenHandler"
> validate="true"/>
>      <add path="/Default.aspx" verb="*"
> type="System.Web.UI.PageHandlerFactory" validate="true"/>
>      <add verb="*" path="*.aspx"
> type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,
> Castle.MonoRail.Framework"/>
>    </httpHandlers>
>
> So this way(in theory) the System.Web.UI.PageHandlerFactory will have
> a go at serving the file first.
> And then all you need is a default.aspx that does the redirect.
>
> <%@ Page Language="C#" %>
>
> <script runat="server">
>    protected override void OnLoad(EventArgs e)
>    {
>        Response.Redirect("~/Home/Index.aspx");
>        base.OnLoad(e);
>    }
> </script>
>
> <!DOCTYPE html PUBLIC
>  "-//W3C//DTD XHTML 1.0 Strict//EN"
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
>    <title>Site Name</title>
> </head>
> <body>
>    <p>
>        If you were not redirected, please <a href="/Home/
> Index.aspx">click here</a>.
>    </p>
> </body>
> </html>
>
> Cheers
> John
>
>
> On Oct 16, 4:15 am, Daniel Hölbling <[email protected]> wrote:
> > No Server.Transfer will throw the UrlTokenizer at you since it can't
> break
> > the Url down into /Controller/Action
> > I solved the whole thing by writing a custom IHttpHandler that accepts
> the
> > path "/Default.aspx" (since *.aspx is mapped to MR) and redirects to
> > /Home/index.aspx
> >
> > Yet, I'm not totally happy with that since it uses a 302 redirect to the
> > homepage. I'd rather like to have the homepage be at /.
> >
> > So I guess I'll retrofit the routing module like Ken suggested.
> >
> > Thanks anyway.
> > greetings Daniel
> >
> > On Thu, Oct 15, 2009 at 4:51 PM, Bill Barry <[email protected]>
> wrote:
> > >  Go ahead, Server.Transfer should work in place of Response.Redirect.
> >
> > > Ken Egozi wrote:
> >
> > > I, personally, don't like it at all. I like that the url (visible in
> the
> > > address bar) of the site's homepage is what it is.
> > > I also suspect that redirecting would yield SEO penalty
> >
> > >  Rewriting (or routing) to the correct location is pretty simple in
> > > Monorail, and even in bad old WebForms (using Server.Transfer), so why
> not
> > > use it?
> >
> > > On Thu, Oct 15, 2009 at 4:34 PM, Symon Rottem <[email protected]>
> wrote:
> >
> > >> Pretty much exactly the way I do it too.
> >
> > >> Symon.
> >
> > >> Symon Rottem
> > >>http://blog.symbiotic-development.com
> >
> > >>   On Thu, Oct 15, 2009 at 4:06 PM, Bill Barry <
> [email protected]>wrote:
> >
> > >>> I do this (actual code from my site, changed redirect string):
> >
> > >>> Default.aspx
> > >>> --
> > >>> <%@ Page Language="vb" %>
> >
> > >>> <!DOCTYPE html>
> >
> > >>> <html>
> > >>> <head runat="server">
> > >>>     <title>Default</title>
> > >>> <script type="text/VB" runat="server">
> > >>>     Public Sub Page_PreInit(ByVal sender As Object, ByVal e As
> EventArgs)
> > >>>         Response.Redirect("~/Home/Index.aspx")
> > >>>     End Sub
> > >>> </script>
> > >>> </head>
> > >>> <body>
> > >>> </body>
> > >>> </html>
> > >>> --
> > >>> (no code behind)
> >
> > >>> Ken Egozi wrote:
> >
> > >>> actual 302 redirect? or server side rewriting?
> >
> > >>> On Thu, Oct 15, 2009 at 3:30 PM, Symon Rottem <[email protected]
> >wrote:
> >
> > >>>> We normally just put a normal default.aspx file into the root of the
> web
> > >>>> app and have it redirect to the requested URL (/Home/Index.aspx in
> your
> > >>>> case).
> >
> > >>>> Symon.
> >
> > >>>> Symon Rottem
> > >>>>http://blog.symbiotic-development.com
> >
> > >>>>   On Thu, Oct 15, 2009 at 3:06 PM, Daniel Hölbling <
> > >>>> [email protected]> wrote:
> >
> > >>>>> This is probably not possible without the routing module is it?
> > >>>>>  Since I'm not using it I hoped I could get around that..
> >
> > >>>>>  greetings Daniel
> >
> > >>>>> On Thu, Oct 15, 2009 at 3:03 PM, Daniel Hölbling <
> > >>>>> [email protected]> wrote:
> >
> > >>>>>> Thanks ken!
> >
> > >>>>>> On Thu, Oct 15, 2009 at 2:58 PM, Ken Egozi <[email protected]>
> wrote:
> >
> > >>>>>>>
> http://www.kenegozi.com/blog/2009/02/10/monorail-routing-and-the-home...
> >
> > >>>>>>> On Thu, Oct 15, 2009 at 2:18 PM, Daniel Hölbling <
> > >>>>>>> [email protected]> wrote:
> >
> > >>>>>>>> Hi, I'm facing a bit of a problem and maybe you can help me out.
> >
> > >>>>>>>>  I'm running a MonoRail application that has no routing
> configured.
> > >>>>>>>> So I'm using MRs standard Area/Controller/Action.aspx scheme.
> > >>>>>>>> (I changed the MonoRail handler to listen for .aspx requests).
> >
> > >>>>>>>>  Now, the problem here is that /Home/Index.aspx is my
> start-page,
> > >>>>>>>> yet if someone comes tohttp://server.com/it's not transferred
> to
> > >>>>>>>> /Home/Index.aspx but is seeing a directory listing forbidden
> page instead.
> >
> > >>>>>>>>  Are there any quick fixes for this? Obviously I can't place a
> > >>>>>>>> Default.aspx that does a Server.Transfer in the root since .aspx
> is getting
> > >>>>>>>> mapped to MR :(
> >
> > >>>>>>>>  greetings Daniel
> >
> > >>>>>>>  --
> > >>>>>>> Ken Egozi.
> > >>>>>>>http://www.kenegozi.com/blog
> > >>>>>>>http://www.delver.com
> > >>>>>>>http://www.musicglue.com
> > >>>>>>>http://www.castleproject.org
> > >>>>>>>http://www.idcc.co.il- הכנס הקהילתי הראשון למפתחי דוטנט - בואו
> > >>>>>>> בהמוניכם
> >
> > >>> --
> > >>> Ken Egozi.
> > >>>http://www.kenegozi.com/blog
> > >>>http://www.delver.com
> > >>>http://www.musicglue.com
> > >>>http://www.castleproject.org
> > >>>http://www.idcc.co.il- הכנס הקהילתי הראשון למפתחי דוטנט - בואו
> בהמוניכם
> >
> > > --
> > > Ken Egozi.
> > >http://www.kenegozi.com/blog
> > >http://www.delver.com
> > >http://www.musicglue.com
> > >http://www.castleproject.org
> > >http://www.idcc.co.il- הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to