Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "sparkyjr"

Hi,

Wherever we have injected few application services into controller class's constructor, and if the constructor of any of these application services has many items injected, then it takes too long (as long as 20 sec) to hit the controller action.

Could you please help and suggest some robust solution here?

Thanks in advance! SparkyJr

Our solution is built using ASPNetZero and our web app is hosted on Azure. The log files in Azure are getting inundated with the following entry (approx. every 2 mins)

WARN XXX... Abp.Auditing.WebAuditInfoProvider - Could not obtain web parameters for audit info. WARN XXX... Abp.Auditing.WebAuditInfoProvider - System.Net.Sockets.SocketException (0x80004005): No such host is known at System.Net.Dns.GetAddrInfo(String name) at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) at System.Net.Dns.GetHostAddresses(String hostNameOrAddress) at Abp.Auditing.WebAuditInfoProvider.GetClientIpAddress(HttpContext httpContext) at Abp.Auditing.WebAuditInfoProvider.Fill(AuditInfo auditInfo)

Tried following the solution described at <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/467">https://github.com/aspnetboilerplate/as ... issues/467</a> but could not find the relevant libraries in the ASPNet Zero solution. We are currently on version 1.9.0 (Package version 0.8.3.0). Is there a way we can selectively disable this log entry? Any other alternate solutions possible?

Thanks. SJ

This turned out to be a red herring. There were some reference changes that were applied to the Web project. It was for some new feature that we were experimenting on. Rolling it back (from csproj) fixed the issue for us.

I have added some methods to CommonLookupAppService. The CommonLookupAppService has the AbpAuthorize attribute, indicating that only authorized users can access this service methods.

Now, I want to suppress authorization for a method in this CommonLookupAppService. I tried using AbpAllowAnonymous and AllowAnonymous attributes, but unfortunately these attributes aren't available in the project.

How do I suppress authorization for a method in any service, which has AbpAuthorize attribute?

Hi,

Is there a place in Web project where I can add my CSS classes that I shall used throughout my project. Ideally, I'm hoping that I wouldn't have to give any stylesheet links on the pages i'm working on. Just use the classes without giving stylesheet reference.

Thanks

Hi,

Suppose I need the TenantId in any controller Action Method, we just say

AbpSession.TenantId

This will return the TenantId of the logged in user.

What if I need to include a custom property in this AbpSession with a value related to the login user? eg.

AbpSession.CustomerFolioNo

Is that possible? If yes, where should I set my custom property? When the User logs in..??

Hi,

_userService.getUsers({ Filter : ""})
            .done(function(result) {
                var users = result.items;
                console.log(users);
            });

This particular code did worked for me. Thanks.

I'm still trying to figure out why I'm not being able to fetch the list of users in my controller.

In Javascript, I tried the following

var _userService = abp.services.app.user;
var allUsers = _userService.getUsers({ Filter : ""});

and then in browser console, I tried to display allUser, it returns a deffered object as shown in the screenshot.....

I also tried

allUsers.done(function(result){
console.log(result);
});

I would like to know how can I fetch the list in javascript

Here is my controller. Please check the '_CreateOrEditKPI' Action

using Abp.AutoMapper;
using Abp.Domain.Repositories;
using PlanQube.Authorization.Users;
using PlanQube.Authorization.Users.Dto;
using PlanQube.Entities;
using PlanQube.Utilities;
using PlanQube.Web.Areas.Mpa.Models.KPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace PlanQube.Web.Areas.Mpa.Controllers
{
    public class KPIController : Controller
    {
        private readonly IRepository<KPI> _KPIRepository;
        private readonly UserAppService _userAppService;
        private readonly UserManager _userManager;

        public KPIController(IRepository<KPI> KPIRepository, UserManager userManager, UserAppService userAppService)// UserAppService userAppService
        {
            _KPIRepository = KPIRepository;
            _userManager = userManager;
            _userAppService = userAppService;
        }

        // GET: Mpa/InitiativeKPI
        public async Task<ActionResult> Index()
        {
            var initiativeKPIs = (await _KPIRepository.GetAllListAsync()).MapTo<List<KPIViewModel>>().ToList();
            return View(initiativeKPIs);
        }

        public PartialViewResult _CreateOrEditKPI(int? id)
        {
            var viewModel = new KPIViewModel();

            if (id.HasValue)
            {
                var output = _KPIRepository.Get((int)id);
                viewModel = new KPIViewModel(output);
            }

            var allUsers = _userManager.Users;
            var allUsers = await _userAppService.GetUsers(new GetUsersInput());
            ViewBag.DdlUsers = new SelectList(allUsers , "Id", "value", null);

            return PartialView("_CreateOrEditKPIModal", viewModel);
        }

    }
}

For the second example, the code would be

public async Task<PartialViewResult> _CreateOrEditKPI(int? id)
        {
            var viewModel = new KPIViewModel();

            if (id.HasValue)
            {
                var output = _KPIRepository.Get((int)id);
                viewModel = new KPIViewModel(output);
            }

            var allUsers = await _userAppService.GetUsers(new GetUsersInput());
            ViewBag.DdlUsers = new SelectList(allUsers , "Id", "value", null);

            return PartialView("_CreateOrEditKPIModal", viewModel);
        }

Hi.

I'm trying to display names of all users of the current tenant in a dropdown. I tried using the following ways to get Users list, but didn't succeed

<ins>Method 1)</ins> In the controller, I tried injecting UserManagerand then in the action method, wrote the following code

var allUsers = _userManager.Users;
ViewBag.DdlUsers = new SelectList(allUsers, "Id", "value", null);

<ins>Method 2)</ins> In the controller, I tried injecting UserAppServiceand then in the action method, wrote the following code

var allUsers = var allUsers = await _userAppService.GetUsers(new GetUsersInput());
ViewBag.DdlUsers = new SelectList(allUsers, "Id", "value", null);

In both cases I'm getting the following error "The operation cannot be completed because the DbContext has been disposed."

I would also like to know if there is a way to get this list in Javascript as JSON

Showing 51 to 60 of 71 entries