Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Cannot access web services (asmx files) when using Site Management Redirect in DNN 6.2.3Cannot access web services (asmx files) when using Site Management Redirect in DNN 6.2.3
Previous
 
Next
New Post
10/23/2012 5:03 PM
 
Whenever I am accessing a site that has a custom module I built with a web service call, I am experiencing an issue where the actual call returns a 401 unauthorized error. If I take the redirect off and go to the site normally, everything works. I have a feeling it has to deal with the way my web.config is set up and the redirect is getting confused when it sees the asmx call. Anyone have any experiences with this? I'm using DNN 6.2.3 community and have full access to my web.config and IIS.
 
New Post
10/24/2012 1:56 AM
Accepted Answer 
In case anyone is curious, I figured this out by creating my own module redirect handler out of the dnn source code:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using System.Web;

using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Controllers;
using DotNetNuke.Entities.Host;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Tabs;
//using DotNetNuke.HttpModules.Config;
//using DotNetNuke.Instrumentation;
using DotNetNuke.Services.EventQueue;
using DotNetNuke.Services.Localization;
using DotNetNuke.Services.Mobile;

namespace myLib.Managers
{
    /// 
    /// ASMXMobileRedirect
    ///
    /// $Date: $
    /// $Author: $
    /// $Revision: $
    /// 
    public class ASMXMobileRedirectModule : IHttpModule
    {
        private IRedirectionController _redirectionController;
        public string ModuleName
        {
            get
            {
                return "MobileRedirectModule";
            }
        }

        #region IHttpModule Members

        public void Init(HttpApplication application)
        {
            _redirectionController = new RedirectionController();
            application.BeginRequest += OnBeginRequest;
        }

        public void Dispose()
        {
        }

        #endregion

        public void OnBeginRequest(object s, EventArgs e)
        {
            var app = (HttpApplication)s;

            //First check if we are upgrading/installing
            if (app.Request.Url.LocalPath.ToLower().EndsWith("install.aspx")
                    || app.Request.Url.LocalPath.ToLower().EndsWith("upgradewizard.aspx")
                    || app.Request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx")
                    || app.Request.Url.LocalPath.ToLower().EndsWith("captcha.aspx")
                    || app.Request.Url.LocalPath.ToLower().EndsWith("scriptresource.axd")
                    || app.Request.Url.LocalPath.ToLower().EndsWith("webresource.axd")
                    || app.Request.Url.LocalPath.ToLower().EndsWith("sitemap.aspx")
                    || app.Request.Url.LocalPath.ToLower().EndsWith(".asmx")
                    || app.Request.Url.LocalPath.ToLower().EndsWith(".ashx")
                    || app.Request.Url.LocalPath.ToLower().EndsWith(".svc"))
            {
                return;
            }

            //second, check to see if it's an asmx call.  
            if (app.Request.Url.LocalPath.Contains("asmx/"))
                return;

            if (_redirectionController != null)
            {
                var portalSettings = PortalController.GetCurrentPortalSettings();
                if (portalSettings != null && portalSettings.ActiveTab != null)
                {
                    if (app != null && app.Request != null && !string.IsNullOrEmpty(app.Request.UserAgent))
                    {
                        //Check if redirection has been disabled for the session
                        //This method inspects cookie and query string. It can also setup / clear cookies.
                        if (!_redirectionController.IsRedirectAllowedForTheSession(app))
                        {
                            return;
                        }

                        string redirectUrl = _redirectionController.GetRedirectUrl(app.Request.UserAgent);
                        if (!string.IsNullOrEmpty(redirectUrl))
                        {
                            app.Response.Redirect(redirectUrl);
                        }
                    }
                }
            }
        }
    }
}
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Cannot access web services (asmx files) when using Site Management Redirect in DNN 6.2.3Cannot access web services (asmx files) when using Site Management Redirect in DNN 6.2.3


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out