Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

433
Vistas
Has anyone implemented DotNetNuke.Abstractions.Portals.IPortalAliasInfo.HttpAlias in DNN version 9.9?

I have recently upgraded my DNN version from 7.3.4 to 9.9. When I compile my solution, I get the following warning:

[Obsolete("Deprecated in 9.7.2. Scheduled for removal in v11.0.0, use DotNetNuke.Abstractions.Portals.IPortalAliasInfo.HttpAlias instead.")]

I tried to implement IPortalAlaiasInfo, but I have been unsuccessful. I looked at the Startup file for DNN and see the following services:

public void ConfigureServices(IServiceCollection services)
{
    services.AddSingleton<WebFormsModuleControlFactory>();
    services.AddSingleton<Html5ModuleControlFactory>();
    services.AddSingleton<ReflectedModuleControlFactory>();
    services.AddSingleton<IDnnContext, DotNetNukeContext>();
    services.AddScoped<IEventLogger, EventLogController>();
    services.AddScoped<IEventLogConfigService, EventLogController>();
    services.AddScoped<IEventLogService, EventLogController>();
    services.AddTransient((IServiceProvider x) => ServiceLocator<IPortalController, PortalController>.Instance);
    services.AddScoped<IHostSettingsService, HostController>();
    services.AddScoped<INavigationManager, NavigationManager>();
    services.AddScoped<ISerializationManager, SerializationManager>();
    services.AddScoped<IApplicationInfo, DotNetNuke.Application.Application>();
    services.AddScoped<IApplicationStatusInfo, ApplicationStatusInfo>();
    services.AddScoped<IPortalAliasService, PortalAliasController>();
}

I do not see a reference to interface IPortalAliasInfo.

Does any one know how to access DotNetNuke.Abstractions.Portals.IPortalAliasInfo.HttpAlias? If so, can you please be so kind to provide an example?

Thank you.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You would access IPortalAliasInfo through IPortalAliasService.GetPortalAlias

I don't know your exact context but let's assume a WebApi endpoint, it would look something like this:

using DotNetNuke.Abstractions.Portals;
using DotNetNuke.Web.Api;
using System;
using System.Linq;
using System.Web.Http;

namespace My.Namespace
{
    public class MyController : DnnApiController
    {
        private readonly IPortalAliasService portalAliasService;

        public MyController(IPortalAliasService portalAliasService)
        {
            this.portalAliasService = portalAliasService;
        }

        [HttpGet]
        [AllowAnonymous]
        public IHttpActionResult GetPrimaryPortalAlias()
        {
            try
            {
                var primaryPortalAlias = this.portalAliasService.GetPortalAliasesByPortalId(this.PortalSettings.PortalId)
                    .First(p => p.IsPrimary);
                return this.Ok(primaryPortalAlias.HttpAlias);
            }
            catch (Exception)
            {
                var message = "Something went wrong";
                return this.InternalServerError(new Exception(message));
                throw;
            }
        }
    }
}

If that's not your context you just have to adjust on how to do the dependency injection part, but the rest is the same principle...

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda