Base solution for your next web application

Activities of "ajayak"

When I add Microsoft.AspNetCore.Mvc in ApplicationService solution and use RedirectAction, it causes server error. I also tried installing AbpAspNetCore package but still no luck.

Is there any other way to perform a redirect?

I have created the following function:

public async Task<RedirectResult> Install(string shop)
        {
            if (!await GenericHelper.IsValidShopDomainAsync(shop))
            {
                throw new UserFriendlyException(L("PP_Invalid_Shopify_Url"));
            }
            return new RedirectResult(_shopifyManager.GetAuthRedirectUrl(shop));
        }

In the code block, when user hits the last line(return new RedirectResult), I am getting following error on client: ![image]( <a class="postlink" href="https://imgur.com/a/qdwfc">https://imgur.com/a/qdwfc</a> )

2shopifyplay.myshopify.com/admin/oauth/authorize?client_id=da2faafba7cc7898876351c74ae39446&scope=read_customers,write_customers&redirect_uri=http://localhost:5000/api/services/app/Shopify/Auth:1 OPTIONS <a class="postlink" href="https://shopifyplay.myshopify.com/admin/oauth/authorize?client_id=da2faafba7cc7898876351c74ae39446&scope=read_customers,write_customers&redirect_uri=http://localhost:5000/api/services/app/Shopify/Auth">https://shopifyplay.myshopify.com/admin ... opify/Auth</a> 404 (Not Found) sales-channel:1 Failed to load <a class="postlink" href="https://shopifyplay.myshopify.com/admin/oauth/authorize?client_id=da2faafba7cc7898876351c74ae39446&scope=read_customers,write_customers&redirect_uri=http://localhost:5000/api/services/app/Shopify/Auth">https://shopifyplay.myshopify.com/admin ... opify/Auth</a>: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404. scripts.bundle.js:44583 WARN: scripts.bundle.js:44583 Content-Type is not sent! Subscriber.js:238 HTTP error: 0, webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:238 webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.error @ Subscriber.js:197 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber._error @ Subscriber.js:128 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.error @ Subscriber.js:102 webpackJsonp.../../../../rxjs/OuterSubscriber.js.OuterSubscriber.notifyError @ OuterSubscriber.js:22 webpackJsonp.../../../../rxjs/InnerSubscriber.js.InnerSubscriber._error @ InnerSubscriber.js:26 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.error @ Subscriber.js:102 webpackJsonp.../../../../rxjs/observable/ErrorObservable.js.ErrorObservable._subscribe @ ErrorObservable.js:77 webpackJsonp.../../../../rxjs/Observable.js.Observable._trySubscribe @ Observable.js:171 webpackJsonp.../../../../rxjs/Observable.js.Observable.subscribe @ Observable.js:159 subscribeToResult @ subscribeToResult.js:22 webpackJsonp.../../../../rxjs/operator/catch.js.CatchSubscriber.error @ catch.js:111 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber._error @ Subscriber.js:128 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.error @ Subscriber.js:102 webpackJsonp.../../../../rxjs/OuterSubscriber.js.OuterSubscriber.notifyError @ OuterSubscriber.js:22 webpackJsonp.../../../../rxjs/InnerSubscriber.js.InnerSubscriber._error @ InnerSubscriber.js:26 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.error @ Subscriber.js:102 webpackJsonp.../../../../rxjs/observable/ErrorObservable.js.ErrorObservable._subscribe @ ErrorObservable.js:77 webpackJsonp.../../../../rxjs/Observable.js.Observable._trySubscribe @ Observable.js:171 webpackJsonp.../../../../rxjs/Observable.js.Observable.subscribe @ Observable.js:159 subscribeToResult @ subscribeToResult.js:22 webpackJsonp.../../../../rxjs/operator/catch.js.CatchSubscriber.error @ catch.js:111 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber._error @ Subscriber.js:128 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.error @ Subscriber.js:102 onError @ http.es5.js:1244 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:425 onInvokeTask @ core.es5.js:3881 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:424 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:192 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:499 invokeTask @ zone.js:1427 globalZoneAwareCallback @ zone.js:1445 XMLHttpRequest.send (async) scheduleTask @ zone.js:2744 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:411 onScheduleTask @ zone.js:301 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:405 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:236 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleMacroTask @ zone.js:259 (anonymous) @ zone.js:2769 proto.(anonymous function) @ zone.js:1274 (anonymous) @ http.es5.js:1275 webpackJsonp.../../../../rxjs/Observable.js.Observable._trySubscribe @ Observable.js:171 webpackJsonp.../../../../rxjs/Observable.js.Observable.subscribe @ Observable.js:159 webpackJsonp.../../../../rxjs/operator/map.js.MapOperator.call @ map.js:54 webpackJsonp.../../../../rxjs/Observable.js.Observable.subscribe @ Observable.js:156 webpackJsonp.../../../../rxjs/operator/catch.js.CatchOperator.call @ catch.js:79 webpackJsonp.../../../../rxjs/Observable.js.Observable.subscribe @ Observable.js:156 webpackJsonp.../../../../rxjs/operator/mergeMap.js.MergeMapOperator.call @ mergeMap.js:85 webpackJsonp.../../../../rxjs/Observable.js.Observable.subscribe @ Observable.js:156 webpackJsonp.../../../../rxjs/operator/catch.js.CatchOperator.call @ catch.js:79 webpackJsonp.../../../../rxjs/Observable.js.Observable.subscribe @ Observable.js:156 SalesChannelComponent._this.installShopify @ sales-channel.component.ts:21 (anonymous) @ SalesChannelComponent.html:17 handleEvent @ core.es5.js:12023 callWithDebugContext @ core.es5.js:13493 debugHandleEvent @ core.es5.js:13081 dispatchEvent @ core.es5.js:8615 (anonymous) @ core.es5.js:10783 schedulerFn @ core.es5.js:3647 webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:238 webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.next @ Subscriber.js:185 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber._next @ Subscriber.js:125 webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.next @ Subscriber.js:89 webpackJsonp.../../../../rxjs/Subject.js.Subject.next @ Subject.js:55 webpackJsonp.../../../core/@angular/core.es5.js.EventEmitter.emit @ core.es5.js:3621 webpackJsonp.../../../forms/@angular/forms.es5.js.NgForm.onSubmit @ forms.es5.js:4032 (anonymous) @ SalesChannelComponent.html:17 handleEvent @ core.es5.js:12023 callWithDebugContext @ core.es5.js:13493 debugHandleEvent @ core.es5.js:13081 dispatchEvent @ core.es5.js:8615 (anonymous) @ core.es5.js:9226 (anonymous) @ platform-browser.es5.js:2651 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:425 onInvokeTask @ core.es5.js:3881 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:424 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:192 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:499 invokeTask @ zone.js:1427 globalZoneAwareCallback @ zone.js:1445

I have created the following function:

public async Task<RedirectResult> Install(string shop)
        {
            if (!await GenericHelper.IsValidShopDomainAsync(shop))
            {
                throw new UserFriendlyException(L("PP_Invalid_Shopify_Url"));
            }
            return new RedirectResult(_shopifyManager.GetAuthRedirectUrl(shop));
        }

In the code block, when user hits exception, I am getting following error on client: ![image]( <a class="postlink" href="https://imgur.com/a/zqhXl">https://imgur.com/a/zqhXl</a> )

2:5000/api/services/app/Shopify/Install?shop=asd:1 GET <a class="postlink" href="http://localhost:5000/api/services/app/Shopify/Install?shop=asd">http://localhost:5000/api/services/app/ ... l?shop=asd</a> 500 (Internal Server Error) sales-channel:1 Failed to load <a class="postlink" href="http://localhost:5000/api/services/app/Shopify/Install?shop=asd">http://localhost:5000/api/services/app/ ... l?shop=asd</a>: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 500. scripts.bundle.js:44583 WARN: scripts.bundle.js:44583 Content-Type is not sent! Subscriber.js:238 HTTP error: 0, webpackJsonp.../../../../rxjs/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:238 ...

I logged into my app. Then the page is redirected to external application(Shopify) which makes request to API in my app service. In my function, I save a FullAuditedEntity but the CreatorUserId and TenantId is null in that case.

I want to access Request object in ApplicationService. As the AppService is not a MVC Controller, how can I do so? I am trying something like this:

var json = new StreamReader(Request.InputStream).ReadToEnd();

How can I read appsettings.json in AppService. Is there any way I can strongly type the appSettings.json configuration as in ASP.NET Core?

I understand that the API is dynamically generated in AspNetZero solution. But can I set HttpPost attribute on any function? Also, I see that the Application project has no reference to AspNetCore.Mvc dll.

Hi,

After downloading the AspNetZero with Angular solution, I found that TsLint was not working. To fix that, I changed Codelyzer version to 5.0.1. I ran TsLint on the solution based on tslint.config present in the Angular solution and I found that there are more than 1000 warnings for the solution. These include warnings such as use of double quotes, max line length exceed etc.

I can fix all of these by myself but it would cause problems in solution upgradation in future. Is it possible for AspNetZero team to fix all the linting issues in next release?

I created a new project and getting this TSLint error in Webstorm and VSCode.

TypeError: Cannot read property '1' of undefined

TypeError: Cannot read property '1' of undefined at Rule.SelectorRule [as constructor] (E:\PrimePenguin\PrimePenguin.Web\node_modules\codelyzer\selectorNameBase.js:16:25) at new Rule (E:\PrimePenguin\PrimePenguin.Web\node_modules\codelyzer\directiveSelectorRule.js:12:28) at Object.loadRules (E:\PrimePenguin\PrimePenguin.Web\node_modules\tslint\lib\ruleLoader.js:47:24) at Linter.getEnabledRules (E:\PrimePenguin\PrimePenguin.Web\node_modules\tslint\lib\linter.js:197:29) at Linter.lint (E:\PrimePenguin\PrimePenguin.Web\node_modules\tslint\lib\linter.js:74:33) at TSLintPlugin.processLinting (C:\Program Files\JetBrains\WebStorm 2017.2.4\plugins\tslint\tslintLanguageService\tslint-plugin.js:76:20) at TSLintPlugin.getErrors (C:\Program Files\JetBrains\WebStorm 2017.2.4\plugins\tslint\tslintLanguageService\tslint-plugin.js:54:21) at TSLintPlugin.process (C:\Program Files\JetBrains\WebStorm 2017.2.4\plugins\tslint\tslintLanguageService\tslint-plugin.js:22:29) at TSLintPlugin.onMessage (C:\Program Files\JetBrains\WebStorm 2017.2.4\plugins\tslint\tslintLanguageService\tslint-plugin.js:40:27) at Interface.<anonymous> (C:\Program Files\JetBrains\WebStorm 2017.2.4\plugins\JavaScriptLanguage\jsLanguageServicesImpl\js-language-service.js:105:39) Process finished with exit code -1

I am currently using AspNetZero v4.2.0. As mentioned in the changelog [https://aspnetzero.com/Documents/Change-Logs#v440-2017-08-25]), there is an update available. How can I manually update the current solution? :)

Showing 81 to 90 of 93 entries