Mono Support URL Rewriting and Adding Custom subdomain  

Viewed 94228 time(s), 12 post(s), 9/5/2011 7:49:29 AM - by adisoft
9/5/2011 7:49:53 AM
35 Reputation 5 Total posts

Hello
We have created a page to register company and after registration, company should be able to register users. default page of the company should have to open like
company.domain.com.
we are tried to use API's of IIS and web.config settings of Monox but we have to make this functionality dynamic. but we have Monox version that does not have source code. how is it possible to add functionality ?
thanks in advance.

1
9/5/2011 8:27:56 AM
15993 Reputation 2214 Total posts

Hi,

  as you mentioned that you have managed the IIS configuration but you need to configure MonoX, can you tell me what exactly do you need to configure in the MonoX, e.g. please describe the functionality you want to develop ?

Do you want the MonoX to know  which company user is looking by the domain or something else ?

Regards

2
9/5/2011 9:09:40 AM
35 Reputation 5 Total posts

Hi,

What we exactly want is that first we create a company profile through company registration and when a company joins this website they will get their own subdomain like company.domain.com.so if a client comes to www.domain.com and signs in (logs in) they get redirected to their company subdomain and they can see the logo etc of that company

But we have Monox version that does not have source code. how is it possible to add the above functionality ???

Regards,

3
9/5/2011 9:17:19 AM
15993 Reputation 2214 Total posts

Hi,

  you don't need source code to redirect the company users to another subdomain you just need to add some functionality to MonoX controls through the MonoX API.

I'll try to put together a small walk-through in a hour, so you can see what you need to tweak to get this done.

Regards

4
9/5/2011 11:01:51 AM
3016 Reputation 428 Total posts

Hi Adisoft,

in order to use your custom logic after users loggin and registration you need to extend MonoX loginModule and use an event from membershipEditor.

1. loginModule - create your own login module which extends the MonoX ones, override RedirectAfterLogin() method and add your custom logic.
2. membershipEditor - you can utilize AccountCreationCompleted event and add your custom logic.

3. To change the logo image you can replace link(MonoX default.master):

<a href='<%= MonoSoftware.Web.UrlFormatter.ResolveServerUrl(MonoSoftware.MonoX.Utilities.LocalizationUtility.
RewriteLink("/")) %>' class="logo"><
img runat="server" src="<%$ Code: MonoSoftware.MonoX.Paths.App_Themes.img.
logo_png %>" alt="MonoX" />
</
a>            

with your custom one.

4.To make some changes to footer section you can modify MonoX pageFooter user control, but loginName and loginStatus should be present in that control markup because they are used in code behind.

5
9/5/2011 12:17:28 PM
35 Reputation 5 Total posts

Hello
Thanks for your replies.
We need that functionality that when ever a company is registered with Monox System, It will have it's own sub domain like, if we have to register a company named 'company1' and our website is www.sitename.domain. after registration company user will be able to create it's own users and it's path would be accessible by htt://company1.sitename.domain.

thanks in advance

6
9/5/2011 12:25:27 PM
15993 Reputation 2214 Total posts

Hi,

ok, great I hope that this will help you find a solution, If you need anything else let us know.

Regards

7
9/5/2011 12:52:55 PM
35 Reputation 5 Total posts

Need help for the issue.

8
9/5/2011 1:10:26 PM
3016 Reputation 428 Total posts

Hi,

you can uset below code snippet for redirecting after the loggin in:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
 
namespace YourNamespace
{
    public partial class LoginModule : MonoSoftware.MonoX.ModuleGallery.LoginModule
    {
        public override void RedirectAfterLogin()
        
                Response.Redirect("htt://company1.sitename.domain");        
        }
    }
}


you can find more information on how to extend MonoX module here.

9
9/5/2011 1:32:35 PM
35 Reputation 5 Total posts

Hi imarusic,

Thanks for reply,you hv provided details about how to redirect after login.
<code style="color: blue;"></code>

But what i m asking is how i can create a subdomain like (htt://company1.sitename.domain) where company1 is a Company username in company registration.

Thanks in advance,

10
1 2
This is a demo site for MonoX. Please visit Mono Software for more info.