I have moved the web.config file from ASAP.Web.Public to ASAP.Web.Host\wwwroot\dist. But facing same issue.
Note: We are using ASP.NET CORE & Angular (single solution). That's why we don't have web.config in angular folder.
We have tried the following changes in web.config.
Change 1:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
<environmentVariables />
</aspNetCore>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Change 2:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Where can we find the web.config file?
I have only one file named web.config in ASAP.Web.Public.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Tue Mar 26 2019 05:30:00 GMT+0530 (India Standard Time)
creatioN_TIME: Moment {_isAMomentObject: true, _i: "2019-04-01T09:42:49", _f: "YYYY-MM-DDTHH:mm:ss", _isUTC: false, {_isAMomentObject: true, _i: "2019-04-30T09:42:49", _f: "YYYY-MM-DDTHH:mm:ss", _isUTC: false, _pf: {…}, …}
Is it possible to create my login credentials as external login provider in appsettings and use it for login? Because there is no option to login into application without password. You are using LoginAsync
method to login. It is accepting the parameter like as username and password or external auth provider details.
Thanks @maliming. It is working now. Can you pls tell me why we not navigate.
i have tried as you mentioned. But it is looping infinite time. The browser is freezing. The code is below:
canActivateInternal(data: Data, state: RouterStateSnapshot): boolean {
debugger;
//if (state != null) {
// if (_.includes(state.url, 'asap-sso')) {
// this._router.navigate(['app/main/asap-sso', 66]);
// return true;
// }
//}
if (UrlHelper.isInstallUrl(location.href)) {
return true;
}
if (!this._sessionService.user) {
//this._router.navigate(['/account/login']);
this._router.navigate(['app/main/asap-sso']);
return false;
}
if (!data || !data['permission']) {
return true;
}
if (this._permissionChecker.isGranted(data['permission'])) {
return true;
}
this._router.navigate([this.selectBestRoute()]);
return false;
}
No.
<input id="createdate" type="text" name="creatioN_TIME" class="form-control" ui-date-format="mm/dd/yyyy" bsDatepicker [(ngModel)]="organization.creatioN_TIME" autocomplete="off">
<input id="Expirydate" type="text" name="expirY_DATE" class="form-control" bsDatepicker [(ngModel)]="organization.expirY_DATE" ui-date-format="mm/dd/yyyy" autocomplete="off">
In ts file to retrive data,
this.CreateDate = new Date(moment(result.creatioN_TIME, 'YYYY-MM-DDTHH:mm:ss').format());
this.ExpiryDate = new Date(moment(result.expirY_DATE, 'YYYY-MM-DDTHH:mm:ss').format());
import { PermissionCheckerService } from '@abp/auth/permission-checker.service';
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanLoad, Router, RouterStateSnapshot } from '@angular/router';
import { AppSessionService } from '@shared/common/session/app-session.service';
import { UrlHelper } from '@shared/helpers/UrlHelper';
import { Data, Route } from '@node_modules/@angular/router/src/config';
import { Observable } from '@node_modules/rxjs/internal/Observable';
import * as _ from 'lodash';
@Injectable()
export class AppRouteGuard implements CanActivate, CanActivateChild, CanLoad {
constructor(
private _permissionChecker: PermissionCheckerService,
private _router: Router,
private _sessionService: AppSessionService
) { }
canActivateInternal(data: Data, state: RouterStateSnapshot): boolean {
debugger;
if (_.includes(state.url, 'asap-sso')) {
this._router.navigate(['app/main/asap-sso', 66]);
return true;
}
if (UrlHelper.isInstallUrl(location.href)) {
return true;
}
if (!this._sessionService.user) {
this._router.navigate(['/account/login']);
return false;
}
if (!data || !data['permission']) {
return true;
}
if (this._permissionChecker.isGranted(data['permission'])) {
return true;
}
this._router.navigate([this.selectBestRoute()]);
return false;
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
return this.canActivateInternal(route.data, state);
}
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
return this.canActivate(route, state);
}
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
return this.canActivateInternal(route.data, null);
}
selectBestRoute(): string {
debugger;
if (!this._sessionService.user) {
return '/account/login';
}
if (this._permissionChecker.isGranted('Pages.Administration.Host.Dashboard')) {
//return '/app/admin/hostDashboard';
return '/app/admin/users';
}
if (this._permissionChecker.isGranted('Pages.Tenant.Dashboard')) {
return '/app/main/dashboard';
}
if (this._permissionChecker.isGranted('Pages.Tenants')) {
return '/app/admin/tenants';
}
if (this._permissionChecker.isGranted('Pages.Administration.Users')) {
return '/app/admin/users';
}
return '/app/notifications';
}
}
I have used below code but it was not working.
if (_.includes(state.url, 'asap-sso')) {
this._router.navigate(['app/main/asap-sso', 66]);
return true;
}