Hi Vasu,
Is it fine to redirect using module class as below instead of creating redirect rule in webconfig file.
[assembly: RegisterModule(typeof(URLModule))]
namespace Modules
{
public class URLModule : Module
{
public URLModule() : base("URLModule")
{
}
protected override void OnInit()
{
base.OnInit();
URLRewritingEvents.ProcessRewritingResult.After += ProcessRewritingResult_After;
}
private void ProcessRewritingResult_After(object sender, URLRewritingEventArgs e)
{
if (e.Parameters.ViewMode == CMS.PortalEngine.ViewModeEnum.LiveSite)
{
var currentUrl = CMSHttpContext.Current.Request.Url;
if (currentUrl != null && ((currentUrl.ToString().Contains("logon.aspx")) || (currentUrl.ToString().Contains("/admin") || (currentUrl.ToString().Contains("/admin/")))))
{
if (currentUrl.ToString().Contains("cms") || currentUrl.ToString().Contains("cms.abc"))
{
}
else
{
var context = CMSHttpContext.Current;
context.RewritePath("/");
e.Parameters.Status = RequestStatusEnum.PathRewritten;
}
}
}
}
}
}