Search Posts

Category: asp.net

Access windows Authenticated Web API through Angular 2 without login prompt

I have already developed front-end application in Angular2 and back-end in ASP.net web APIs. I had used Windows authentication as enabled because I want to detect requesting user. Both applications are hosted in IIS server(Windows Server 2012). When I load angular app it load login prompt and when give correct user credentials data loading happen correctly. But I want to know a way to load them without login prompt, authenticate automatically. This is the way […]

search product table data by multiple fields using angular js and web api

I have Product table with 20 columns.I want to search table by multiple field Value. As a input parameters, i have 3 dropdownlist(family,body,series).Based on the selected values product table will be searched. Search might be based on single parameter or multiple parameters Here is the Controller [Route(“api/KendoCascading/GetProresult/{family}”)] public HttpResponseMessage GetProresult(int family) { using (CrossReferenceTool1Entities eb = new CrossReferenceTool1Entities()) { var query = (from u in eb.Products where (u.PrivateOnly == false && u.SelectionTool == true && […]

Conditionally render an AngularJS template in ASP.NET

I’m using AngularJS on top of ASP.NET with C#. I have several partial AngularJS templates, but not all users should be able to access all templates. My client is using a database table to store the permissions for the different pages. I query the database and place the results of this query in a dynamic object that looks something like this (when serialized to JSON): {“page-one”: {“PageName”: “Page One”, “PageURL”: “page-one.html”, “Authorized”: true}, “page-two”: {“PageName”: […]

Validating a negative number on MVC Framework

I have a problem with the validation that which the data cannot be negative in a specific transaction which is from purchased minus the remaining and the result is to the remaining quantity. The data must not be transact or having a negative number on the data column. CONTROLLER public JsonResult LoadPageData(Page page) { int beginning = page.itemPerPage * (page.PageNumber – 1); List<Stocks> stocks = new List<Stocks>(); using (var context = new InventoryDbContext()) { var […]

AngularJS1 : ng-blur inside the ng-if

I’m trying to use ng-blur. Below is my HTML code: <div ng-if=”CurrentStage===’SaveQuery'”> <div class=”col-sm-12″> <div class=”form-group row”> <label class=”col-sm-3 control-label text-right”>Query Name</label> <div class=”col-sm-9″> <input type=”text” ng-blur=”performValidationQueryName()” ng-model=”QueryName” ng-class=”QueryNameError?’form-control validation_error’:’form-control'” placeholder=”Query Name” /> <span ng-if=”QueryNameErrorMsg!=”” class=”errorMsg”>{{QueryNameErrorMsg}}</span> </div> <div class=”clearfix”></div> </div> </div> </div> JavaScript code for blur event call is: $scope.performValidationQueryName = function () { if($scope.QueryName != null && $scope.QueryName != ”) {} }; The issue I’m facing is: When ng-if=”CurrentStage===’SaveQuery'” is there inside div, my […]

AngularJS on Azure Server Error

I have an AngularJS web app, with an ASP.NET Web API back end. It works fine on one Azure instance, and is live. But I tried creating a different Azure instance and deploying to it, in order to do some testing of new features, and I can’t get it to run. What it does, is it gives me the generic Server Error page that .NET gives. Even though I have CustomErrorss set to off, I […]

Getting Method Not Allowed when using AngularJS Delete

I’ll be glad to get your help. I’m using AngularJS version 1.6.5 and trying to use http delete method. On server side i’m using asp.net MVC5 Web API. When i’m trying to delete a record i’m getting error 405 (Method Not Allowed). This is my AngularJS code: $scope.Delete = function (CustomerNumber) { $http.defaults.headers[“delete”] = { ‘Content-Type’: ‘application/json,charset=utf-8’ }; $http({ method: “DELETE”, url: “/Api/Customer/” + CustomerNumber }).then(function successCallback(response) { $scope.Customers = response.data; $scope.addCustomer.$setPristine(); $scope.addCustomer.$setUntouched(); $scope.Customer = […]

Next Page »