Search Posts

Category: asp.net

CORS configuration on IIS 6 webserver

From an angular 4 application I’m trying to access an older .aps webpage on an IIS server. I am getting a 401 error which I believe is CORS related. Based on information I found I have configured the IIS server with the following header information: Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS Access-Control-Allow-Headers: Content-Type I have done both at the application level and at the webserver level. But I still get the 401 error. The information I am […]

Looping through Angular API calls

I have a list of items and I want to pass the selected items to the API and check if that item exists or not. $scope.submitButton = function() { for (var i=0; i < $scope.selectedItems.length; i++) { console.log($scope.selectedItems[i]); // item2 myService.checkItem($scope.selectedItems[i]) .success(data, status, header, config) { var myData = data; console.log(myData); }) } } When I select item2 and click the button, I only want the service to return data for item2 but it returns […]

Angularjs fails with passing data from ASP.Net Razor view

Recently I had a situation, when the user typed in input textbox something like “{{ text :}}” and saved it. And this caused the Angular fail on some pages. So, if I pass data to my controller from Razor view like this @{ var test = “{{ test :}}”; } <html> <head> </head> <body ng-app=”TestApp” ng-controller=”TestCtrl” ng-init=”test = ‘@test’;”> </body> </html> I get following error https://docs.angularjs.org/error/$parse/syntax?p0=:&p1=is%20an%20unexpected%20token&p2=6&p3=test%20:&p4=: Syntax Error: Token ‘:’ is an unexpected token at […]

angular md-datepicker is showing 1 day behind

<md-datepicker ng-model=”objGeneralDetails.strReferenceDate” name=”Dated1″ ng-required=”false” ng-class=”{ datepicker : (!POMain.Dated1.$valid && submitactive )}” md-placeholder=”Dated” style=”margin-left:-10px;”></md-datepicker> date picker is showing in correct date to model objGeneralDetails.strReferenceDate. how can i fix this ?? Source: AngularJS

How can Asp Net Core serve html static pages?

I start recently an Asp .Net Core app. Later i want to integrating it with Angular, but first i want a mechanism that will ‘replace’ cshtml with html. If i change extension from cshtml to html i get this ‘InvalidOperationException: The view ‘Index’ was not found’. Also i tried in Startup app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: “default”, template: “{controller=Home}/{action=Index}/{id?}”); }); but also didn’t work. Optional is to integrating cshtml layout content with html pages, […]