Search code examples
asp.netwebformsasp.net-membershipforum

Sign in to ASP.NET forum from non-forum page


I have an Umbraco (ASP.NET CMS) website. Inside this website I have created a directory called 'forum' and into that directory I have installed 'JitBit' ASP.NET forum. The 'forum' folder in my site is running as an application in IIS as per the forum documentation. It works great.

So to be clear, my website and forum are on the same domain e.g http://www.example.com and http://www.example.com/forum.

Now I want to have a log-in form on the website homepage, containing 'username' and 'password' fields which posts to the forum and signs the user in. There is no membership system on the main website, just the forum, but I'd like users to log in to the forum from the website homepage.

It seems that JitBit forum uses ASP.NET webforms, and the log-in form on the forum homepage posts to itself (just default.aspx) so my question is, can I post to a webforms page somehow from a non webforms page and get this log-in to work? I've tried the obvious simple HTML post from the homepage, using the correct username and password input names, but that doesn't work. Is there a way to make this work or do I have to build a membership system on the main website and cross-authenticate when a user gets to the forum?

Many thanks for any pointers.


Solution

  • I solved this adding value="Request.Form["Username"]" and value="Request.Form["Password"]" in the log-in input fields in the forum masterpage, then injecting some JavaScript to submit the log-in form on page load if those two values are present (if the log-in form has been posted). It's a little bit of a hack but works nicely.

    I couldn't do anything with usercontrols as per @user3771965's suggestion as the parent site is MVC and I don't have source to the forum.