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

Activities of "alwefaq"

Hi, 1- Open DateTimeIssueProject.sln 2- Run DateTimeIssueProject.Migrator 3- Run DateTimeIssueProject.Web.Host 4- Run Angular Project 5- go to http://localhost:4200/account/register 6- fill required info and click submit 7- debug Register method in AccountAppService 8- check FirstDateTime and SecondDateTime from RegisterInput dto

** note that the values are provided from register.component.ts and both are set to moment("2014-02-27T10:00:00")

Hi, I have sent an email containing the sample project show the issue.

abp package version is 5.5

service-proxies.ts

    /**
     * @param body (optional) 
     * @return Success
     */
    testDate(body: SomeDto | null | undefined): Observable<void> {
        let url_ = this.baseUrl + "/api/services/app/Contract/TestDate";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_ : any = {
            body: content_,
            observe: "response",
            responseType: "blob",
            headers: new HttpHeaders({
                "Content-Type": "application/json", 
            })
        };

        return this.http.request("post", url_, options_).pipe(_observableMergeMap((response_ : any) => {
            return this.processTestDate(response_);
        })).pipe(_observableCatch((response_: any) => {
            if (response_ instanceof HttpResponseBase) {
                try {
                    return this.processTestDate(<any>response_);
                } catch (e) {
                    return <Observable<void>><any>_observableThrow(e);
                }
            } else
                return <Observable<void>><any>_observableThrow(response_);
        }));
    }

    protected processTestDate(response: HttpResponseBase): Observable<void> {
        const status = response.status;
        const responseBlob = 
            response instanceof HttpResponse ? response.body : 
            (<any>response).error instanceof Blob ? (<any>response).error : undefined;

        let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }};
        if (status === 200) {
            return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
            return _observableOf<void>(<any>null);
            }));
        } else if (status !== 200 && status !== 204) {
            return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            }));
        }
        return _observableOf<void>(<any>null);
    }


export class SomeDto implements ISomeDto {
    dateTime!: moment.Moment;

    constructor(data?: ISomeDto) {
        if (data) {
            for (var property in data) {
                if (data.hasOwnProperty(property))
                    (<any>this)[property] = (<any>data)[property];
            }
        }
    }

    init(data?: any) {
        if (data) {
            this.dateTime = data["dateTime"] ? moment(data["dateTime"].toString()) : <any>undefined;
        }
    }

    static fromJS(data: any): SomeDto {
        data = typeof data === 'object' ? data : {};
        let result = new SomeDto();
        result.init(data);
        return result;
    }

    toJSON(data?: any) {
        data = typeof data === 'object' ? data : {};
        data["dateTime"] = this.dateTime ? this.dateTime.toISOString() : <any>undefined;
        return data; 
    }
}

export interface ISomeDto {
    dateTime: moment.Moment;
}

Hi,

This is what the class looks like, please let me know if there's something specific you need to know.

public class SomeDto {
    [Required]
    [DisableDateTimeNormalization]
    public DateTime DateTime {get; set;}
}

public abstract class BaseDDDApplicationService : ApplicationService, IApplicationService {
}

public interface IBookingAppService : IApplicationService {
    Task TestDate(SomeDto dto);
}

public class BookingAppService : BaseDDDApplicationService, IBookingAppService {
    public async Task TestDate(SomeDto dto){
        // do stuff
    }
}

I tried it and it didn't work as expected, it kept the same behaviour. after some more investigation, it works only if it on a parameter directly, but it does not work if it was on a DTO property.

is there something i can try to make it work on a DTO property?

` public async void TestDate([DisableDateTimeNormalization]DateTime datetime){} // this works

public class SomeDto { [DisableDateTimeNormalization] public DateTime datetime {get; set;} } public async void TestDate(SomeDto dto){} // this does not work `

What is your product version? 5.1.0 What is your product type (Angular or MVC)? Angular Angular CLI: 6.2.3 Node: 12.13.0 OS: win32 x64 Angular: 6.1.7 What is product framework type (.net framework or .net core)? .net core What language code are you using? (en, tr, etc)? Arabic - ar

Page not found !

So why Asp.net Zero don't cal the external identity server and get the token and refresh token automatically after change the settingd below ? :

"IdentityServer": { "IsEnabled": "true", "Authority": "http://localhost:63636/", //external identity server

Please can you give a full answer on this issue .

Hi Maliming ,

Thanks for your response .

  • Actully angular project use Token after generated from /api/TokenAuth/Authenticate api .

  • We need any project to call Extrenal Identity Server 4(http://localhost:63636) when they want to Authenticate any user and generate the Token for this user (Username and password).

  • As the documentation for Identity server we need to only apply changes below , then any Authetiation request and Tokens should generated from External Identity server :

"IdentityServer": { "IsEnabled": "true", "Authority": "http://localhost:63636/",

  • Please can let me know if this applicable in aspnetzero ?

Best regards

Answer

@Kasem Hi, I hope you are doing well :) I am facing the same issue , Could you please clarify which places you did your changes either front-end or server side with sample codes so, i can fix it on our solution :)

Showing 11 to 20 of 20 entries