Base solution for your next web application

Activities of "walkerscott"

Question

Hi,

How can I set the tenant based on URL?

Scenario is an email is sent to the users with the URL to access specific page. The URL has an identifier that can let us know what tenant the URL is for. In our case GUID.

What we want is upon accessing the URL, if not logged in, it will set the Tenant on TenancyName on Login Page. So that the page will not lose the return URL as well.

I was able to set the Tenant but I can't write the cookie for Abp.TenantId. I write it on SessionAppService.GetCurrentLoginInformations(), but can't write the cookie from it.

My code for writing the cookie is below..

_httpContextAccessor.HttpContext.Response.Cookies.Append(
                    "Abp.TenantId",
                    userUrlTenantId.ToString(),
                    new CookieOptions
                    {
                        Expires = DateTimeOffset.Now.AddYears(5),
                        Path = "/"
                    }
                );
Question

Hi,

Is it possible to change existing project from ASP.NET MVC 5.x & Angularjs 1.xto ASP.NET Core & Angular?

subscribing to updates on this one :)

Hi.

We created an API Endpoint same as the solution on this ticket (#3295). We managed to create an API Response with Status Code 304 with our desired return fields when we encountered an error in the validation. But when the process is all good and accepted with Status Code 200 , it shows different return and ignored the API Response we created. Please see the code snippets below for reference.

using block:

using Abp.Domain.Repositories;
using AutoMapper;
using PRJ.Application.Dto;
using PRJ.Core.Entities;
using PRJ.OrderTask.OrderTaskDto;
using PRJ.Utility;
using System;
using System.Collections.Generic;
using System.Web;
using System.Linq;
using System.Net.Http;
using System.Net;
using System.Web.Script.Serialization;
using PRJ.Common.Dto;
using System.Net.Http.Headers;

Class implementation:

public class OrderUploadAppService : PRJAppServiceBase, IOrderUploadAppService

IF Status Code 200:

APIResponse apiResponse = new APIResponse()
{
   ResponseCode = (int)HttpStatusCode.OK,
   ResponseMessage = "Success",
   OrderUploadId = orderUploadId,
   ValidationMessages = validationMessage 
};

var json = new JavaScriptSerializer().Serialize(apiResponse);
response = new HttpResponseMessage()
{
   StatusCode = HttpStatusCode.OK,
   Content = new StringContent(json)
};

return response;

IF Status Code 304:

APIResponse apiResponse = new APIResponse()
{
   ResponseCode = (int)HttpStatusCode.NotModified,
   ResponseMessage = "Validation unsuccessful, check validation messages.",
   OrderUploadId = 0,
   ValidationMessages = validationMessage 
};

var json = new JavaScriptSerializer().Serialize(apiResponse);
response = new HttpResponseMessage()
{
   StatusCode = HttpStatusCode.NotModified,
   Content = new StringContent(json)
};

return response;

Expected Return for 200:

{
   "ResponseCode":200,
   "ResponseMessage":"Success.",
   "OrderUploadId":123,
   "ValidationMessages":[]
}

Actual Return for 200:

{
    "success": true,
    "result": null,
    "error": null,
    "unAuthorizedRequest": false
}

Actual Return for 304:

{
   "ResponseCode":304,
   "ResponseMessage":"Validation unsuccessful, check validation messages.",
   "OrderUploadId":0,
   "ValidationMessages":[]
}

The question is why in 200, the API ignores the customized return. At break point, it passes the setup of API Response, JSON Serialization and encountered no errors but shows different response once done? And if 304, there's no problem displaying the desired return.

If the default response for 200 cannot be modified, how can I put a value (string or int or obj) on the result field? Something like this:

{
    "success": true,
    "result": "TESTResponseMessage",
    "error": null,
    "unAuthorizedRequest": false
}

Thank you.

<cite>ismcagdas: </cite> Hi,

If I understand correctly, this might be what you want <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-samples/tree/master/PhoneBook-MPA/Acme.PhoneBook.WebApi.Host">https://github.com/aspnetzero/aspnet-ze ... ebApi.Host</a>.

Thanks.

Thank you for this. Will study the solution and hope this will put me to the right direction. Thanks again. :D

Thanks, thought that must have been the case.

Thanks, understood and that is great functionality.

What about objects that are consistent for all Tenants, such as static roles?

Take the following example: I have 50 tenants and would like to update a static role (Manager) to include a new permission. The new permission needs to be included for all Manager roles in all tenants.

Using impersonation, I would need to impersonate 50 tenant admin users and make the change manually, which is time consuming, and adds some risk of making only the required change.

Note, the scenario doesn't just apply to Roles, but other objects that are tenant agnostic.

Is there another approach that you could recommend to support this type of scenario?

Is it possible for Host users to globally manage tenant values e.g. Tenant Roles, Users, Settings etc. ?

Use case is SaaS application where the Host is providing support for the Tenant.

Hi.

We have an existing MVC solution that is in ABP v4.0.30319. Is it possible to add a new API project on the solution? Or create an API Endpoint in one of the controllers? Kindly advice on what is the best approach in creating an API Endpoint.

Thanks.

subscribing to this

Showing 11 to 20 of 59 entries