Model binding subdomain information

16 views
Skip to first unread message

Rex Morgan

unread,
Nov 5, 2010, 4:57:59 PM11/5/10
to FubuMVC Development Group
Hello Everyone,

I'm attempting to create a site that allows a user to sign up and
access their content through a subdomain. Something like Tumblr, when
a user signs up, they have access to their posts through
http://<username>.tumblr.com/

The way I was hoping it would work, is that the username would be
pulled from the url and set on the input model, just like it's done
for other properties on the input model passed in through the query
string. Then my actions would be expecting this property to be set and
could put the request in the proper context.

I've done a bit of digging around in Fubu and it looks like I'll need
to either make a couple changes to RouteDefinition or create my own
implementation of IRouteDefinition in order to do this. It looks like
the current implementation of RouteDefinition is concerned with only
the path of the url and doesn't care about the rest of it.

I think implementing this will require changes in quite a few places
within FubuMVC. When creating urls and model binding is what comes to
mind immediately.

I wanted to validate this with everyone and make sure I'm headed in
the right direction before I spend too much time possibly headed down
the wrong path. Does this sound like the proper course of action, or
would there be a better/more elegant way to achieve the same results?

Thanks,
Rex

Joshua Flanagan

unread,
Nov 5, 2010, 8:56:42 PM11/5/10
to fubumv...@googlegroups.com
If you are going to go down that path, you will have to make sure ASP.NET routing supports the domain, since thats what Fubu relies on. I don't think it does, and not sure it should.

You would probably have better luck trying to bind the HTTP_HOST or SERVER_NAME server variable to your input models. Try adding a property with one of those names to your input model and see if it gets populated. If not, it shouldn't be too difficult to modify how AggregateDictionary is wired up to make these available to models.


--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To post to this group, send email to fubumv...@googlegroups.com.
To unsubscribe from this group, send email to fubumvc-deve...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.


Rex Morgan

unread,
Nov 6, 2010, 1:53:56 AM11/6/10
to FubuMVC Development Group
Joshua,

Thanks for the pointers. I didn't realize that Fubu would
automatically populate those values into the model, and honestly
didn't think to try and check the request for them, either. I guess I
was just so focused on getting it to work the way I had originally
thought of. I'm glad I posted the question.

I was able to get both of those values populating, so that should be a
very good starting point in getting the information that was passed
into the subdomain, all I need to do is parse it out from the url.

Thanks,
Rex

On Nov 5, 7:56 pm, Joshua Flanagan <joshuaflana...@gmail.com> wrote:
> If you are going to go down that path, you will have to make sure
> ASP.NETrouting supports the domain, since thats what Fubu relies on. I
> > fubumvc-deve...@googlegroups.com<fubumvc-devel%2Bunsubscribe@goog legroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages