It's difficult to find what the problem is without seeing an example. I assume you are trying based on this documentation? One thing to note is that sitelets are matched in the order in which they are passed to the builder with .With<_>(), and the wizard-generated sitelet is string-parameterized, which means that it will match any URL with a single path element. So if you want another sitelet to accept a URL such as /foo, then you need to pass it before the string one. For example in the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    [EndPoint("GET /foo")]
    public class Foo { }

    [EndPoint("GET /bar")]
    public class Bar { }

    public class Server
    {
        [Website]
        public static Sitelet<object> Main =>
            new SiteletBuilder()
                .With<Foo>((ctx, ep) => Content.Text("Foo matched"))
                .With<string>((ctx, ep) => Content.Text("Plain content: " + ep))
                .With<Bar>((ctx, ep) => Content.Text("Bar matched"))
                .Install();
    }

/foo will return "Foo matched", but bar will return "Plain content: bar" and not "Bar matched".

By on 10/28/2016 6:16 AM ()

Your example works, but the documentation doesn't say anything about the apparently required "GET" before the path.

By on 10/28/2016 7:29 AM ()

Hmm, it shouldn't be required (not specifying the method should accept any method), but there seems to be a bug indeed. I'll look into it as soon as possible.

By on 10/28/2016 7:34 AM ()

Thanks!

By on 10/28/2016 7:41 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper