Base solution for your next web application

Activities of "kumaran"

Hi

I have .net core and angular subscription.

So far i have tested everthing with a staging site and everything is working fine.

After publishing to prod (new site) all i am seeing is "An error as occured" and details not sent by server. Now how do i find what is wrong.
The db is created, user is created, the api site is showing up properly.

In staging i had similar problem but that was related to multitenat and when i disable the users were created (documented here - https://support.aspnetzero.com/QA/Questions/5408)

[AbpPermissions] table is empty as well

Now i am stuck. How do i see the server error log? I need to go live today. Can anyone please help. Thanks.

Hi

I am using v5.5.0.0 and i am showing these dates in a modal window. This was not created by rad tool.

By the way i was able to fix it by doing the following.

Point me to the right direction to upgrade the code to the latest version because the code has been customized a lot in the project. Don't want to mess the existing code.

Thanks.

  1. In the html i had the following .. <input class="form-control" type="datetime" #Show_ShowDate id="Show_ShowDate" name="Show_ShowDate" required>

  2. In the typescript i had

ngAfterViewInit(): void { ..

    // default date picker
    $(this.Show_ShowDate.nativeElement).datetimepicker({
        locale: abp.localization.currentLanguage.name,
        format: 'L LT'
    });

}

  1. When i show the modal window, to load the data from the db, ..

            let startDateTime: Element = document.getElementById("Show_ShowDate");
    
            if (startDateTime) {
                (startDateTime as HTMLInputElement).defaultValue = moment(this.showVar.showDate).format('L LT');
            }
    

Hi

My problem is similar to this support issue https://support.aspnetzero.com/QA/Questions/4328
The links inside the above support case does not work.

The issue i am having is in a modal dialog.

Here is my UI for the datetime picketr

<input class="form-control" type="datetime" [(selectedDate)]="showVar.showDate" #Show_ShowDate id="Show_ShowDate" name="Show_ShowDate" required>

In the edit mode the datetime picker control is empty instead of showing the model value.

Any reason why?

Thanks

Hi

Just to let you know that i have solved my problem. This will help others who have the same issue.

The issue is my request to my controller method is in a image url where i get the image as byte array. Because of this the UI layer is not attaching the bearer token. As a workaround i moved the method that returns the array to the service layer and called through the proxy.

In order to render the image with the byte array i followed the way it is done in this link. http://www.macaalay.com/2014/09/26/rendering-images-from-byte-arrays-and-converting-images-to-byte-arrays-using-angularjs/

You should be kidding me. You want me to create a mini project just to reproduce the error for you? I cannot send you my entire project.

Hi

Sorry my initial one has no "MyTicketImage" later i added them. It still does not work.

what i can think of the difference between the profile controller and my controller is in profile controller the uploaderoption is sending the bearer token from the ui to the server.

In my case i am not sending anything from the UI. Is that the reason? If that is the reason, how i do i send the token. Mine is just a image url that renders the image by calling a controller method.

Thanks

Here is my code.

using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Runtime.Session;
using Events.Order;
using Events.Show;
using Events.Show.Dtos;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace Events.Web.Controllers
{
    
    public class TicketController : EventsControllerBase
    {
        private readonly IShowsAppService _showAppService;
        private readonly OrderManager _orderManager;


        public TicketController(
            OrderManager orderManager,
            IShowsAppService showAppService)
        {
            _showAppService = showAppService;
            _orderManager = orderManager;
        }

        [AbpMvcAuthorize]
        public async Task<ActionResult> GetTicketImage(int orderId)
        {
           long currentUserId = AbpSession.GetUserId();
           Order.Order order = await _orderManager.GetOrderDetails(orderId, currentUserId);

            var invalidOrder = "Invalid Order";
            byte[] ticketImagByteArr;
            if (order != null && order.OrderStatus == OrderStatus.Paid)
            {
                var showForView = await _showAppService.GetShowForView(new EntityDto(order.ShowId));
                if (showForView != null && showForView.Show != null)
                {
                    ShowDto show = showForView.Show;

                    string qrTicketDetailString = GenerateQrStringFromOrder(order, show);

                    ticketImagByteArr = OrderLibrary.GetTicketQR(qrTicketDetailString);

                    return File(ticketImagByteArr, "png", "EventOrder-" + orderId);
                }

            }

            //render an invalid order qr code.
            ticketImagByteArr = OrderLibrary.GetTicketQR(invalidOrder);

            return File(ticketImagByteArr, "png", "EventOrder-Invalid");
        }


        private static string GenerateQrStringFromOrder(Order.Order order, ShowDto show)
        {
            string output = string.Empty;

           ..
           ..
           ..

            return output;

        }
    }
}

I am using Angular and .net core. I am trying to add a new controller Get method in proj.Web.Core project.

In this method i need to access my logged in current user id so it is a secured method.

When the UI calls this url i get the following Request URL: http://localhost:22742/Profile/GetMyTicketImage?orderId=8011 Request Method: GET Status Code: 302 Found

and then redirects to

Request URL: http://localhost:22742/Account/Login?ReturnUrl=%2FProfile%2FGetMyTicketImage%3ForderId%3D8011 Request Method: GET Status Code: 404 Not Found

What i am missing when i am adding a new controller method?

If it is an anonymous method, it its of no use as i dont get my current user id. I have seen another controller method when you post the profile picture in profile controller which access the current user id and that one works but not mine.

Can anyone help?

I have a similar issue just like gowthamv. what is the solution for this. I do not find any error in the audit logs.

found the fix. I have to ignore those attributes in CustomDtoMapper.cs that are not required to be mapped. In my case the order object in the order child tables needs to be ignored otherwise you get into recursive relationship.

       configuration.CreateMap&lt;CreateOrEditOrderDetailDto, OrderDetail&gt;().ForMember(x => x.Order, opt => opt.Ignore());
       configuration.CreateMap&lt;CreateOrEditRewardDto, Reward.Reward&gt;().ForMember(x => x.Order, opt => opt.Ignore());
       configuration.CreateMap&lt;CreateOrEditOrderPromotionDto, OrderPromotion&gt;().ForMember(x => x.Order, opt => opt.Ignore());
Showing 1 to 10 of 47 entries