my razor view is accepting a model ... and I have this code in it ..

@{
    var my_value = "wth";
    if (Model.app != null)
    { my_value = Model.app.name; }
}

@Html.TextBoxFor(a => a.app.name, new { @Value = my_value })

shows 'wth' when the model isn't null ... did some debugging to see if my_value is set properly ... hmmm

I am having a hard time with AngularJs. It works accordingly in some cases for me and when I try to change the template of the project, it doesn't work anymore. Here is the scenario - I have a controller in ASP.NET MVC that returns the list of products in Json format and finally I call this controller using AngularJs controller as follows:

C#:

public JsonResult GetProducts()
{
    var result = (from c in db.Products
                  select new { c.ProductName, c.Price }).ToList();

    return Json(result, JsonRequestBehavior.AllowGet);
}

AngularJs:

var app = angular.module('app', []);

app.controller('ProductController', function ($scope, ProductService) { 
    $scope.Products = null;

    ProductService.GetProducts().then(function (d) {
        $scope.Products = d.data;

    }, function () {
        alert('Failed');
    });
});

app.factory('ProductService', function ($http) {
    var factory = {};

    factory.GetProducts = function () {
        return $http.get('/Product/GetProducts');
    }
    return factory;
});

In the UI, I've used the following:

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Get Products</title>

    <script src="~/Scripts/angular.js"></script>
    <script src="../AngularFile/AddToCart.js"></script>
</head>
<body>
    <div>
        <h2>Get Products</h2>
        <div ng-app="app" class="container">
            <br /><br />
            <br /><br />
            <input type="text" ng-model="name" />
            <h1>{{ name }}</h1>
            <div ng-controller="ProductController">
                <table class="table table-responsive" ng-repeat="m in Products">
                    <tr>
                        <td>{{ m.ProductName }}</td>
                        <td>{{ m.Price }}</td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</body>
</html>

The output I am getting is this:

Sample Products


I am not sure what I am doing wrong. In my earlier project, using the same code, it shows products properly but right now, I am getting data in Json format. Is this common and anyone faced like this before?

Note: If I change the method type from JsonResult to ActionResult, it shows nothing.

I work with asp.net web api and Identity
I want to register users with sms only. without username, email and password (like telegram)
when user install my app, the only thing it want from user is his phone number.
Then an verify code is sent to him with sms and he will be registered.
and then the user can get token.

Attention: I not use Two-Factor Authentication.

Is It Possible In Identity?
Or with changes in Identity?
Or should I completely write all the apps myself?

I'm working on a client/server model for a university project using .NET and on the client I'm using MVVM but for server I was thinking of using a Database First approach with Entity Framework which is MVC. Will it cause any issues if they follow different architecture patterns?

I'm refreshing my view model onRouteMatched...

    _onRouteMatched: function(oEvent) {
        this.getView().setModel(new JSONModel({siteInfo: {}, surveyInfo: {}, categories: []}), "view");
        var oViewModel = this.getView().getModel("view");
}

However, if I'm returning to the page without refreshing (by pressing the back arrow and then returning), I'm getting a duplicate ComponentId error when creating the view again.

        var oPanel = new sap.m.Panel({
           expandable: true,
           expanded: false,
           headerText: oData.results[0].CategoryDesc,
           id: "Panel" + index
        });

It's as though the view component "Panel" still exists, so that a new one can only be created on refresh, not onRouteMatched.

This works fine if I refresh the page, but how can I get the view to refresh on onRouteMatched?

I have field for decimal price, for instance 20,00 and want to write my own validation message instead of default "The field Price must be a number". As I soon have understood, I get validation error because of comma in number, view interprets it as a string. So that I should fix this as well.

I found this solution written by @DarinDimitrov, I write custom model binder

public class PriceModelBinder : DefaultModelBinder
{
    public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
    {
        var displayFormat = bindingContext.ModelMetadata.DisplayFormatString;
        var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);

        if (!string.IsNullOrEmpty(displayFormat) && value != null)
        {
            decimal price;
            if (decimal.TryParse(value.AttemptedValue, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out price))
            {
                return price;
            }
            bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Неверный формат числа");
        }
        return base.BindModel(controllerContext, bindingContext);
    }
}

I also add it in Global.asax

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();
    ModelBinders.Binders.Add(typeof(decimal), new PriceModelBinder());
}

Besides I add to web.config <globalization culture="ru-RU" uiCulture="ru-RU" /> in <system.web>. When I place a breakpoint and try to add entity from view, but nothing changes, I get the same default error string. Moreover breakpoint wasn't caught.

After a little more search I found that model binder works only when POST-method is calling, but my method is already POST as I add entity. I tried to add check in controller ModelState.IsValid, but it has no effect, as form wasn't sent to server. Here my ideas is over, maybe someone can help. Down I write parts of model, view and controller.

public class ServiceDto
{
    //other properties
    [Display(Name = "Цена"), DataType(DataType.Currency, ErrorMessage = "Неверный формат числа")]
    [Required(ErrorMessage = "Цена услуги обязательна")]
    public decimal Price { get; set; }
}

@Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })

public class OperatorController : Controller
{
    [HttpPost]
    public ActionResult CreateService(ServiceDto serviceDto)
    {
        //mapping here
        _unitOfWork.Services.Create(service);
        _unitOfWork.Save();
        return RedirectToAction("Index");
    }
}

whenever I hook up fluent validation to my asp.net core mvc app I start getting NullReferenceException, I've followed the integration guide for asp.net core on github but I can't figure it out where is failing. bellow is my model class an validator and service configuration

public void ConfigureServices(IServiceCollection services) {

  var appSettings = Configuration.GetSection("AppSettings");
  services.Configure<AppSettings>(appSettings);


  #region FluentValidation
  services.AddTransient<IValidator<ContactFormModel>, ContactFormValidator>();
  services.AddTransient<IValidator<BookingSearchViewModel>, BookingSearchModelValidator>();
  services.AddTransient<IValidator<BookingCarSelectionViewModel>, BookingCarSelectionValidator>();
  services.AddTransient<IValidator<BookingClientDataModel>, BookingClientDataValidator>();
  #endregion


  services.AddMvc().AddFluentValidation();
  services.AddAutoMapper(typeof(Startup));      
}

my model class and validator

public class BookingSearchViewModel
  {
    [Display(Name ="Fecha de Recogida")]
    public DateTime? PickupDate { get; set; }

    [Display(Name = "Fecha de Entrega")]
    public DateTime? DropoffDate { get; set; }

    [Display(Name = "Transmisión")]
    public CarTransmissionEnum Transmission { get; set; }

    public List<SelectListItem> transmissionOptions { get; set; }

    public BookingSearchViewModel()
    {

      var list = new List<string>
      {
        "Manual",
        "Automatico"
      };

      this.transmissionOptions = new List<SelectListItem> {
        new SelectListItem
        {
          Text="Manual"
        },
        new SelectListItem
        {
          Text="Automatico"
        }
      };
    }

  }
  public class BookingSearchModelValidator : AbstractValidator<BookingSearchViewModel>
  {
    public BookingSearchModelValidator()
    {
      RuleFor(x => x.PickupDate).NotNull().GreaterThan(DateTime.Now).Must(FiveDaysFromToday);
      RuleFor(x => x.DropoffDate).NotNull().GreaterThan(x => x.PickupDate).Must((form, countyId) => BeAValidRange(form.PickupDate, form.DropoffDate));
      RuleFor(x => x.Transmission).IsInEnum();
    }

    private bool FiveDaysFromToday(DateTime? pickupDate)
    {
      if (pickupDate.HasValue)
      {
        var today = DateTimeOffset.UtcNow.Date.ToCST().DateTime;
        var days = pickupDate.Value.Date.ToCST().Subtract(today).Days;
        return days > 3;
      }
      return false;
    }

    private bool BeAValidRange(DateTimeOffset? pickupDate, DateTimeOffset? dropoffDate)
    {
      if (pickupDate.HasValue && dropoffDate.HasValue)
      {
        var days = dropoffDate.Value.Subtract(pickupDate.Value).Days;
        if (days > 2 && days < 29)
          return true;
      }
      return false;
    }

  }

this is the stack trace

NullReferenceException: Object reference not set to an instance of an object.
FluentValidation.AspNetCore.FluentValidationClientModelValidatorProvider.CreateValidators(ClientValidatorProviderContext context)
Microsoft.AspNetCore.Mvc.ModelBinding.Validation.CompositeClientModelValidatorProvider.CreateValidators(ClientValidatorProviderContext context)
Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache.GetValidators(ModelMetadata metadata, IClientModelValidatorProvider validatorProvider)
Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultValidationHtmlAttributeProvider.AddValidationAttributes(ViewContext viewContext, ModelExplorer modelExplorer, IDictionary<string, string> attributes)
Microsoft.AspNetCore.Mvc.ViewFeatures.ValidationHtmlAttributeProvider.AddAndTrackValidationAttributes(ViewContext viewContext, ModelExplorer modelExplorer, string expression, IDictionary<string, string> attributes)
Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.AddValidationAttributes(ViewContext viewContext, TagBuilder tagBuilder, ModelExplorer modelExplorer, string expression)
Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GenerateInput(ViewContext viewContext, InputType inputType, ModelExplorer modelExplorer, string expression, object value, bool useViewData, bool isChecked, bool setId, bool isExplicitValue, string format, IDictionary<string, object> htmlAttributes)
Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GenerateTextBox(ViewContext viewContext, ModelExplorer modelExplorer, string expression, object value, string format, object htmlAttributes)
Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.GenerateTextBox(ModelExplorer modelExplorer, string inputTypeHint, string inputType)
Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Process(TagHelperContext context, TagHelperOutput output)
Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner+<RunAsync>d__0.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
AspNetCore._Views_Home_Index_cshtml+<<ExecuteAsync>b__39_7>d.MoveNext() in Index.cshtml
+
                  <input asp-for="PickupDate" class="form-control" placeholder="mm/dd/yyyy" required type="text" />
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext+<GetChildContentAsync>d__31.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper+<ProcessAsync>d__7.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner+<RunAsync>d__0.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
AspNetCore._Views_Home_Index_cshtml+<ExecuteAsync>d__39.MoveNext() in Index.cshtml
+
    var pixelImage = appSettings.Value.PixelImage;
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Razor.RazorView+<RenderPageCoreAsync>d__16.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Razor.RazorView+<RenderPageAsync>d__15.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Razor.RazorView+<RenderAsync>d__14.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor+<ExecuteAsync>d__22.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor+<ExecuteAsync>d__21.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.ViewResult+<ExecuteResultAsync>d__26.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeResultAsync>d__19.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeNextResultFilterAsync>d__24.MoveNext()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeNextResourceFilter>d__22.MoveNext()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeFilterPipelineAsync>d__17.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeAsync>d__15.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Builder.RouterMiddleware+<Invoke>d__4.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+<Invoke>d__7.MoveNext()

this is how I'm executing the view

public IActionResult Index()
    {
      var model = new BookingSearchViewModel();
      return View(model);
    }

I've tried removing the nullable properties in the model, initializing them, removing the validation rules but I still get the same error , I'm using FluentValidation.AspNetCore v7.2.0.

How can I fix this null exception?

Thanks

In my Asp.net Mvc5 Application, I have created admin area in my admin area I have controller for post with Action method  as 

    In my admin area, I have a created layout page (_Layout.cshtml) in this I have implemented “materializesCSS” tabs. I have a Controller by name Article, Author etc,  in same admin area which is implementing Crud operation, I need to fill tabs with Create Views from different controller example Create View of Author to Create new Author Create View from Article for Creating new Article etc. 

This is what I have done so far 

 @{ RenderBody(); } // This is to ignore RenderBody
    <main>
        <div class="container">
            <div class="card hoverable">
                <div class="row">
                    <div class="col s12">


  <ul id="tabs-swipe-demo" class="tabs">
   <li class="tab col s3"><a class="active" href="#test-swipe-1">+ Article</a></li>
   <li class="tab col s3"><a href="#test-swipe-2">+ Create Author</a></li>
   <li class="tab col s3"><a href="#test-swipe-3">+ Create New Article</a></li>


     </ul>
         <div id="test-swipe-1" class="col s12">
            @{ Html.RenderAction("Create","Author");} </div>
         <div id="test-swipe-2" class="col s12 red">
            @{ Html.RenderAction("Create","Article");} </div>

                </div>
            </div>

        </div>

    </div>

         </main>

When I execute this I get the following error
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll


System.StackOverflowException was unhandled
  HResult=-2147023895
  Message=Exception of type 'System.StackOverflowException' was thrown.
  InnerException:

Note: Here RenderBody is muted out on purpose if I use RenderBody it will load only one Create View, in other tabs I couldn’t load. Kindly help me to find out what i am doing wrong

I wonder what is the proper way to add a new model into the database and populate it with the proper values without the need of constructing a whole new View inside the project.

My database is already created and is been updated thru the Views of the project.

This is the DbInitializer at the moment:

 public class DbInitializer
 {
    public static void Initialize(PlataformaContext context)
    {
        context.Database.EnsureCreated();

        if (context.MachineTypes.Any())
        {
            return; //DB has been seeded
        }

        var familias = new MachineFamily[]
            {
                new MachineFamily{FamilyDescription="Cama Saltarina"},
                new MachineFamily{FamilyDescription="Hockey"},
                new MachineFamily{FamilyDescription="Kiddie"},
                new MachineFamily{FamilyDescription="Mini Carrusel"},
                new MachineFamily{FamilyDescription="Peluchera"},
                new MachineFamily{FamilyDescription="Redemption"},
                new MachineFamily{FamilyDescription="Simulador"},
            };
        foreach (MachineFamily f in familias)
        {
            context.MachineFamilies.Add(f);
        }
        context.SaveChanges();
    }
 }

So far I only update the database thru migrations if I were to add a new model or property, but I would like to add a new model with a set of values, can I re-use the DbInitializer for this without dropping the current database? How should it be edited? I'm afraid that if I change it I might overwrite some part of it.

Thanks

I'm not a backend developer, so I apologize ahead of time if I do not provide enough information. I am just trying to find some resources that will help my backend developer understand what I am trying to do.

I am trying to make an AJAX GET request to an rss feed inside of web application that was built using ASP.NET Web Forms. However, the request gets blocked because of Cross Origin Security. I want to enable CORS for the route that is associated with our RSS feed (/page/rss/{id}).

I was able to enable CORS in our webconfig using:

<httpProtocol>
    <customHeaders>
        <add name="Access-Control-Allow-Origin" values="*" />
        <add name="Access-Control-Allow-Methods" values="GET" />
        <add name="Access-Control-Allow-Headers" values="Content-Type" />
   </customHeaders>
</httpProtocol>

But, that enables it for the entire project which is not what I want. Our routes are defined in an XML file like this:

<namespace.routing>
  <routings>
    <route name="publishedPage" url="page/{PageName}" page="~/Default.aspx" />
  </routings>
  <defaults>
    <default url="http://blog.example.com" domain="example.com" page="page/homepage" />
  </defaults>
</namespace.routing>

So, how would one go about enabling CORS on a specific path in ASP.NET Web Forms? If someone could point me in the direction of some resources that would help us that would be great. If you need anymore information I'm happy to provide it. Thanks!

This question already has an answer here:

My View and Model and Controller is ready ,but i cant figur out why i get Object reference is not set to an instance of an object for @foreach in view and i also debug foreach in view is returning null and i also debug var bla in controller is also returning null, did i miss something some where ?!

Controller:

public ActionResult OrdreOpenDetails(string id)
{
    DataContext data_2 = new DataContext();
    Ordre_Open_Details_VM oodvm = new Ordre_Open_Details_VM();

    var bla = (from salesLine in data_2.Sales_Line
               join s1 in data_2.Sales_Comment_Line on salesLine.Document_No_ equals s1.No_
                into step1
               from SalesCommentLine in step1.DefaultIfEmpty()
               join s2 in data_2.Sales_Header on salesLine.Document_No_ equals s2.No_
                                       into step2
               from SalesHeader in step2.DefaultIfEmpty()
               join s3 in data_2.Salesperson_Purchasers on SalesHeader.Salesperson_Code equals s3.Code
                                       into step3
               from SalesPersonPurchasers in step3.DefaultIfEmpty()
               join s4 in data_2.Purchase_Line on salesLine.Købsordrenr_ equals s4.Document_No_
                                       into step4
               from PurchaseLine in step4.DefaultIfEmpty()
               join s5 in data_2.Sales_Shipment_Line on salesLine.No_ equals s5.No_
                                        into step5
               from SalesShipmentLine in step5.DefaultIfEmpty()

               join s6 in data_2.Track_and_Trace on SalesShipmentLine.Document_No_ equals s6.Shipping_No_
                                        into step6
               from TrackAndTrace in step6.DefaultIfEmpty()

               join s7 in data_2.Item_Ledger_Entry on SalesShipmentLine.Document_No_ equals s7.Document_No_
               into step7
               from ItemLedgerEntry in step7.DefaultIfEmpty()

               join s8 in data_2.Sales_Shipment_Header on SalesShipmentLine.Document_No_ equals s8.No_
               into step8
               from SalesShipmentHeader in step8.DefaultIfEmpty()
               where
                 salesLine.Document_No_ == id
                 &&
                 SalesHeader.Document_Type == 1
               select
          new DBhandling.Ordre_Open_Details_VM.OrderDetailLine
        {
            Ordrenummer = SalesHeader.No_,
            Kundenummer = SalesHeader.Sell_to_Customer_No_,
            Kundenavn = SalesHeader.Bill_to_Name,
            Ordredato = SalesHeader.Order_Date,
            Kunderef=SalesHeader.External_Document_No_,
            Varenummer=salesLine.No_,
            Beskrivelse=salesLine.Description,
            AntaltBestilt=salesLine.Quantity,
            ManglendeAntal=salesLine.Outstanding_Quantity,
            ForventetLevering=salesLine.Planned_Delivery_Date,
            Kommenter=SalesCommentLine.Comment,
            ForventetLeveringDirekte=PurchaseLine.Planned_Receipt_Date,
            BillToAdresse=SalesHeader.Bill_to_Address,
            BillToContact=SalesHeader.Bill_to_Contact,
            ShipToName=SalesHeader.Ship_to_Name,
            ShipToAdresse=SalesHeader.Ship_to_Address,
            ShipToCity=SalesHeader.Ship_to_City,
            SalesPersonName=SalesPersonPurchasers.Name,
            BillToContryRegionCode=SalesHeader.Bill_to_Country_Region_Code,
            ShipToPostCode=SalesHeader.Ship_to_Post_Code,
            ShipToContryRegionCode=SalesHeader.Ship_to_Country_Region_Code,
            BillToPostCode=SalesHeader.Bill_to_Post_Code,
            PostingGroup=salesLine.Posting_Group,
            PrisPrStk=salesLine.Unit_Price,
            Belob=salesLine.Amount,
            BilltoCity=SalesHeader.Bill_to_City,
            EANNo=SalesHeader.EAN_No_,
            WebMercsOrdrenummer=SalesHeader.Webmercs_ordrenr_,
            QuantityDeliverdLineOpenOrdre=SalesShipmentLine.Quantity,
            LerveringsDatoDeliverdLineOpenOrdre=SalesShipmentHeader.Shipment_Date,
            SerialNoDeliverdLineOpenOrdre=ItemLedgerEntry.Serial_No_,
            LotNoDeliverdLineOpenOrdre=ItemLedgerEntry.Lot_No_,
            ShippingAgentDeliverdLineOpenOrdre=TrackAndTrace.Shipping_agent,
            TrackAndTraceDeliverdLineOpenOrdre =TrackAndTrace.Track_and_Trace,
            TrackLinkDeliverdLineOpenOrdre=TrackAndTrace.Track_and_trace_path,
            KundenummerDeliverdLineOpenOrdre=SalesShipmentHeader.Sell_to_Customer_No_,
            VarenummerDeliverdLineOpenOrdre=SalesShipmentLine.No_,
            ShipToContact = SalesHeader.Ship_to_Contact


        }).ToList();


    return View(oodvm);
}

ViewModel:

 public class Ordre_Open_Details_VM
    {
        public List<OrderDetailLine> OrderDetailLines { get; set; }
       public class OrderDetailLine
       {
           public OrderDetailLine()
           {

           }
           public OrderDetailLine(string Ordrenummer, string Kundenummer, string Kundenavn, DateTime Ordredato, string Kunderef, string Varenummer, string Beskrivelse, decimal AntaltBestilt, decimal ManglendeAntal, DateTime ForventetLevering, string Kommenter, DateTime ForventetLeveringDirekte, string BillToAdresse, string BillToContact, string ShipToName, string ShipToAdresse, string ShipToCity, string SalesPersonName, string BillToContryRegionCode, string ShipToPostCode, string ShipToContryRegionCode, string BillToPostCode, string PostingGroup, decimal PrisPrStk, decimal Belob, string BilltoCity, string EANNo, string WebMercsOrdrenummer, decimal QuantityDeliverdLineOpenOrdre, DateTime LerveringsDatoDeliverdLineOpenOrdre, string SerialNoDeliverdLineOpenOrdre, string LotNoDeliverdLineOpenOrdre, string ShippingAgentDeliverdLineOpenOrdre, string TrackAndTraceDeliverdLineOpenOrdre, string TrackLinkDeliverdLineOpenOrdre, string KundenummerDeliverdLineOpenOrdre, string VarenummerDeliverdLineOpenOrdre, string ShipToContact)
           {
               this.Ordrenummer = Ordrenummer;
               this.Kundenummer = Kundenummer;
               this.Kundenavn = Kundenavn;
               this.Ordredato = Ordredato;
               this.Kunderef = Kunderef;
               this.Varenummer = Varenummer;
               this.Beskrivelse = Beskrivelse;
               this.AntaltBestilt = AntaltBestilt;
               this.ManglendeAntal = ManglendeAntal;
               this.ForventetLevering = ForventetLevering;
               this.Kommenter = Kommenter;
               this.ForventetLeveringDirekte = ForventetLeveringDirekte;
               this.BillToAdresse = BillToAdresse;
               this.BillToContact = BillToContact;
               this.ShipToAdresse = ShipToAdresse;
               this.ShipToName = ShipToName;
               this.ShipToCity = ShipToCity;
               this.SalesPersonName = SalesPersonName;
               this.BillToContryRegionCode = BillToContryRegionCode;
               this.ShipToPostCode = ShipToPostCode;
               this.ShipToContryRegionCode = ShipToContryRegionCode;
               this.BillToPostCode = BillToPostCode;
               this.PostingGroup = PostingGroup;
               this.PrisPrStk = PrisPrStk;
               this.Belob = Belob;
               this.BilltoCity = BilltoCity;
               this.EANNo = EANNo;
               this.WebMercsOrdrenummer = WebMercsOrdrenummer;
               this.QuantityDeliverdLineOpenOrdre = QuantityDeliverdLineOpenOrdre;
               this.KundenummerDeliverdLineOpenOrdre = KundenummerDeliverdLineOpenOrdre;
               this.LotNoDeliverdLineOpenOrdre = LotNoDeliverdLineOpenOrdre;
               this.LerveringsDatoDeliverdLineOpenOrdre = LerveringsDatoDeliverdLineOpenOrdre;
               this.SerialNoDeliverdLineOpenOrdre = SerialNoDeliverdLineOpenOrdre;
               this.KundenummerDeliverdLineOpenOrdre = KundenummerDeliverdLineOpenOrdre;
               this.ShippingAgentDeliverdLineOpenOrdre = ShippingAgentDeliverdLineOpenOrdre;
               this.TrackAndTraceDeliverdLineOpenOrdre = TrackAndTraceDeliverdLineOpenOrdre;
               this.TrackLinkDeliverdLineOpenOrdre = TrackLinkDeliverdLineOpenOrdre;



           }

           public string Ordrenummer { get; set; }
           public string Kundenummer { get; set; }
           public string Kundenavn { get; set; }
           public DateTime? Ordredato { get; set; }
           public string Kunderef { get; set; }
           public string Varenummer { get; set; }
           public string Beskrivelse { get; set; }
           public decimal AntaltBestilt { get; set; }
           public decimal ManglendeAntal { get; set; }
           public DateTime? ForventetLevering { get; set; }
           public string Kommenter { get; set; }
           public DateTime? ForventetLeveringDirekte { get; set; }
           public string BillToAdresse { get; set; }
           public string BillToContact { get; set; }
           public string ShipToName { get; set; }
           public string ShipToAdresse { get; set; }
           public string ShipToCity { get; set; }
           public string SalesPersonName { get; set; }
           public string BillToContryRegionCode { get; set; }
           public string ShipToPostCode { get; set; }
           public string ShipToContryRegionCode { get; set; }
           public string BillToPostCode { get; set; }
           public string PostingGroup { get; set; }
           public decimal PrisPrStk { get; set; }
           public decimal Belob { get; set; }
           public string BilltoCity { get; set; }
           public string EANNo { get; set; }
           public string WebMercsOrdrenummer { get; set; }
           public decimal QuantityDeliverdLineOpenOrdre { get; set; }
           public DateTime? LerveringsDatoDeliverdLineOpenOrdre { get; set; }
           public string SerialNoDeliverdLineOpenOrdre { get; set; }
           public string LotNoDeliverdLineOpenOrdre { get; set; }
           public string ShippingAgentDeliverdLineOpenOrdre { get; set; }
           public string TrackAndTraceDeliverdLineOpenOrdre { get; set; }
           public string TrackLinkDeliverdLineOpenOrdre { get; set; }
           public string KundenummerDeliverdLineOpenOrdre { get; set; }
           public string VarenummerDeliverdLineOpenOrdre { get; set; }
           public string ShipToContact { get; set; }



       }

View:

@model DBhandling.Ordre_Open_Details_VM


<h2>OrdreOpenDetails</h2>

<div class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-4 col-md-5">
                <div class="card">
                    <div class="card-header" data-background-color="purple">
                        <h4 class="title">Detaljer</h4>
                        @*<p class="category">Detaljer <span>»</span> Order nr <span>»</span> @Model.SalesInvoiceHeader.Order_No_</p>*@
                    </div>
                    <div class="card-content">
                        <form>
                            @foreach (var Field in Model.OrderDetailLines)
                            {


                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Order nr.</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.Ordrenummer">
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde nummer</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.Kundenummer">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde Navn</label>
                                            <input type="datetime" class="form-control border-input" disabled value="@Field.Kundenavn">
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Ordre Dato</label>
                                            <input type="datetime" class="form-control border-input" disabled value="@Field.Ordredato">
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde reference</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.Kunderef">
                                        </div>
                                    </div>

                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Varenummer</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.Varenummer">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Beskrivlese</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.Beskrivelse">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Antalt bestilt</label>
                                            <input type="number" step=".01" class="form-control border-input" disabled value="@Field.AntaltBestilt">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Manglende Antal</label>
                                            <input type="number" step=".01" class="form-control border-input" disabled value="@Field.ManglendeAntal">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Forventet levering</label>
                                            <input type="datetime" class="form-control border-input" disabled value="@Field.ForventetLevering">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kommenter</label>
                                            @if (Field.Kommenter !=null)
                                            {
                                                <input type="text" class="form-control border-input" disabled value="@Field.Kommenter">


                                            }
                                            else{
                                            @:&nbsp;
                                            }
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Forventet Leverings Direkte</label>
                                            @if (Field.ForventetLeveringDirekte !=null)
                                            {
                                                <input type="datetime" class="form-control border-input" disabled value="@Field.ForventetLeveringDirekte">

                                            }
                                            else
                                            {
                                            @:&nbsp;

                                            }
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde Adrs</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.BillToAdresse">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde Kontakt</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.BillToContact">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Leverings Navn</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.ShipToName">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Leverings Adrs</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.ShipToAdresse">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Leverings by</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.ShipToCity">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Leverings Kontakt</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.ShipToContact">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Sales Person Name</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.SalesPersonName">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde Region</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.BillToContryRegionCode">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Leverings Post Kode</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.ShipToPostCode">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Leverings Region</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.ShipToContryRegionCode">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde Poste Kode</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.BillToPostCode">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Posting Group</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.PostingGroup">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Pris Pr Stk</label>
                                            <input type="number" step=".01" class="form-control border-input" disabled value="@Field.PrisPrStk">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Beløb</label>
                                            <input type="number" step=".01" class="form-control border-input" disabled value="@Field.Belob">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>Kunde By</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.BilltoCity">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group label-floating">
                                            <label>EANNO</label>
                                            <input type="text" class="form-control border-input" disabled value="@Field.EANNo">
                                        </div>
                                    </div>
                                </div>

                            }

                            <div class="clearfix"></div>
                        </form>
                    </div>


                </div>

            </div>
        </div>
    </div>
</div>

I am facing this error while i was trying to convert the session object type to int, I need to use that value in another query which is of datatype int.

SqlConnection sqlConnection1 = new SqlConnection("Persist Security Info=False;Integrated Security=true;Initial Catalog=Remember;server=DESKTOP-59SGH72\\SQLEXPRESS;Trusted_Connection=True;Database=sport");
        SqlCommand cmd = new SqlCommand();
        SqlDataReader reader;

        cmd.CommandText = "select user_id from users where user_name='" + Session["usern"] + "'";
        cmd.CommandType = CommandType.Text;
        cmd.Connection = sqlConnection1;

        sqlConnection1.Open();

        reader = cmd.ExecuteReader();

        Session["userid"] = reader;

        var uid = Convert.ToInt16(Session["userid"]);

        // Data is accessible through the DataReader object here.

        sqlConnection1.Close();

Please help me with this error !!

I'm new in MVC & .NET and just out of curiosity, is it possible to call a HTML file as a pop up view ? If yes how would I do it ?

Currently I have a code for pop up window inside my Index.cshtml. I want to move the part of the code that is part of the pop up window into separate file or HTML and call it based on conditions by using javascript.

Here's my code for the pop up window:

 <div class="modal fade" tabindex="-1" id="loginModal" data-keyboard="false" data-backdrop="static">
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">
                ×
            </button>
            <h4 class="modal-title">Add To Homepage Prompt</h4>
            <button type="submit" class="btn btn-primary button button4">Okay</button>
       </div>
    </div>
</div>

@section scripts{

<script type="text/javascript">

    $("#loginModal").modal('show');

</script>  

}

I have an ASP.Net MVC 5 application that has been live for a while now. In order to add new features, I recently added SignalR which required me to switch from the Classic Managed Pipeline to Integrated.

When I did so, HttpContext.Current.User began to show as null in the Application_AuthenticateRequest in my Global.asax. I did a little digging and found this question:

HttpContext.Current.User is null under windows authentication (integrated pipeline)

I moved my code to Application_PostAuthenticateRequest and this seemed to work. However, it seems that any time my application needed to authorize, it would prompt me to login.

A little more digging, and I found this:

HttpContext.Current.User is null even though Windows Authentication is on

In this article, it says to handle the code in Application_AuthorizeRequest. When doing so, User is populated, but when I call Roles.GetRolesForUser(HttpContext.Current.User.Identity.Name), I receive the following error:

"Method is only supported if the user name parameter matches the user name in the current Windows Identity."

I ran through several checks on both my development environment and my test environment. I made sure that my windows user matched my logged in user. I compared strings of WindowsIdentity.GetCurrent().User and HttpContext.Current.User.Identity.Name. I did a little manipulation to see if ensuring the domain was included in the user name. But none of this made any difference.

I am using Roles.GetRolseForUser() to build a custom principal and would like to keep this without having to rebuild this part of my app.

Any assistance is greatly appreciated!

Update: I forgot to include info from my web.config:

<authentication mode="Windows" />
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider" />
<identity impersonate="true" />

I'm creating an ASP.Net form with a fileupload control which will then email the details of the form and the file to another admin. I want to ensure this secure (for the server and the recipient). The attachment should be a CV so I will restrict it to typical text documents.

From what I can tell the best bet is to check that the file extension or MIME Type is of that kind and check it against the "magic numbers" to verify that the extension hasn't been changed. I'm not too concerned about how to go about doing that but want to know if that really is enough.

I'd also be happy to use a third party product that takes care of this and I've looked at a couple:

blueimp jQuery file upload http://blueimp.github.io/jQuery-File-Upload/

and cutesoft ajaxuploader http://ajaxuploader.com/Demo/

But blueimp one still seems to require custom server validation (i guess just being jQuery it just handles client-side validation) and the .net one checks the MIME-type matches the extension but I thought the MIME type followed the extension anyway.

So,

Do I need to worry about server security when the file is added as an attachment but not saved? Is there a plugin or control that takes care of this well? If I need to implement something for server validation myself is matching the MIME-type to the "magic numbers" good enough?

I'm sure nothing is 100% bulletproof but file upload is pretty common stuff and I assume most implementations are "safe enough" - but how!?

If it's relevant, here is my basic code so far

<p>Please attach your CV here</p>
<asp:FileUpload ID="fileUploader" runat="server" />

and on submit

MailMessage message = new MailMessage();
if (fileUploader.HasFile)
{
    try
    {
        if (fileUploader.PostedFile.ContentType == "text")
        {
            // check magic numbers indicate same content type... if(){}

            if (fileUploader.PostedFile.ContentLength < 102400)
            {
                string fileName = System.IO.Path.GetFileName(fileUploader.PostedFile.FileName);
                message.Attachments.Add(new Attachment(fileUploader.PostedFile.InputStream, fileName));
            }
            else
            {
                // show a message saying the file is too large
            }
        }
        else
        { 
           // show a message saying the file is not a text based document
        }
    }
    catch (Exception ex)
    {
        // display ex.Message;
    }
}

We were unsuccessful in getting an OWIN Web API service deployed using a Windows Service (as described in this StackOverflow question). After numerous attempts to resolve the issue, we decided to simply create an ASP.NET Web API site and deploy it through IIS.

When run locally, all actions are reachable. However, if we publish the site (using Build -> Publish, or any variant thereof), we observe the following:

  1. When we browse to the machine name and port, we are presented with a directory listing for the virtual directory.
  2. When we request a controller action, the site returns HTTP Error 503. The service is unavailable.
  3. No errors are logged to the Windows Application Event Log on the target server.
  4. The same occurs when the request is executed on either the hosting server or a client machine.

The URL ACL has been created as follows:

netsh http add urlacl http://+:8098/api user=Everyone

The firewall doesn't appear to be blocking the port (as we can get to it through step 1, above). The URL ACL exists, and everyone in the company has access to it (as they should). We do not know why this is occurring, and can't seem to find a suitable answer.

Can someone please suggest a cause or possible solution that we might have overlooked?

I am new to Oauth authentication method so i am not understanding the error i got, I am getting error while getting the authorization token , it shows "twitterizer exception was unhandled by the user code. The remote server returned an error: (401) Unauthorized."

 public static string GetTwitterAuthorizationUrl()
    {
        string consumerKey = ITRMData.DtPageUtils.GetConfig("TweetConsumerKey");
        string consumerSecret = ITRMData.DtPageUtils.GetConfig("TweetConsumerSecretKey");
       OAuthTokenResponse requestAccessTokens = OAuthUtility.GetRequestToken(consumerKey, consumerSecret); //<--getng error here       
        return "https://twitter.com/oauth/authorize?oauth_token=" + requestAccessTokens;}

In above code am getting error at OauthUtility.getRequestToken, I have checked whether consumer key is not getting called but that was not the issue . i have tried giving the key directly in the double quotes, calling the keys are not issue . I am trying but not able debug error if anyone helps it would be great help.

the following is my OauthUtility class in twitterizer

public static class OAuthUtility
{
    public static Uri BuildAuthorizationUri(string requestToken);
    public static Uri BuildAuthorizationUri(string requestToken, bool authenticate);
    public static Uri BuildAuthorizationUri(string requestToken, bool authenticate, string callbackAddress);
    public static string EncodeForUrl(string value);
    public static OAuthTokenResponse GetAccessToken(string consumerKey, string consumerSecret, string requestToken);
    public static OAuthTokenResponse GetAccessToken(string consumerKey, string consumerSecret, string requestToken, string pinNumber);
    public static OAuthTokenResponse GetRequestToken(string consumerKey, string consumerSecret);
}

i want debug this error , otherwise if anyone knows any other ways for creating Oauth authentication for twitter in windows forms pls share the links where i can undertsand it completely.

I have an ASP.NET project with two WebJobs, one of the WebJobs publishes fine but the second fails to publish and I get the following error message:

The target "AddScheduledJob" does not exist in the project.

Both WebJobs where set up in the "Run on Demand" mode.

I am struggling to find any explanation for this error and cannot see what is different between my two WebJobs. Anyone come across this?

​I'm doing configuring a build in VSTS from an ASP.NET MVC application, the whole process until Publish Artifacts occurs normally, but in the task of Windows Machine File Copy I get the following error: "The term 'Get-VstsLocString' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

​ ​My server is a dedicated server with windows server 2012, I did not do any more configuration over there, it is already running some applications, I just want to automate the deploy process. I do not know if this problem is by my dedicated or lack of some configuration in VSTS, below the settings of the Task

enter image description here

I can't to display file icons according to file extensions in asp.net GridView.

The structure of GridView is nested

I don't have error but the column of gridview for show icons is empty.

enter image description here

My code below.

Can you help me?

Thank you in advance for any help, really appreciated.

.cs

protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        string root = @FilePath;
        string folder = GridView2.DataKeys[e.Row.RowIndex].Value.ToString();

        GridView gvOrders = (GridView)e.Row.FindControl("gvOrders");

        DirectoryInfo directory = new DirectoryInfo(root + "/" + folder);
        FileInfo[] fileInfo = directory.GetFiles("*.*",
        `SearchOption.AllDirectories);

        foreach (GridViewRow gvr in gvOrders.Rows)
        {

            LinkButton lnkDownload = (LinkButton)gvr.FindControl("LinkButton");
            Image ib = (Image)gvr.FindControl("ib1");
            string path = lnkDownload.Text;
            string exten = path.Substring(path.LastIndexOf("."));
            if (exten == ".pdf")
                ib.ImageUrl = "images/pdf.GIF";

        }            

        gvOrders.DataSource = fileInfo;
        gvOrders.DataBind();
    }
}

.aspx

<asp:TemplateField>
    <ItemTemplate>
        <img alt="" style="cursor: pointer" src="images/plus.png" />
        <asp:Panel ID="pnlOrders" runat="server" Style="display: none">
            <asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false" 
             CssClass="mGrid" Width="700" HorizontalAlign="Center">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Image runat="server" ID="ib1" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Download" 
                         ItemStyle-HorizontalAlign="Justify">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkDownload" 
                                 Text='<%# Eval("Name") %>' 
                                 CommandArgument='<%# Eval("FullName") %>' 
                                 runat="server"
                                OnClick="lnkDownload_Click" 
                                OnClientClick="if (!confirm('Sure ?')) return false;">
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </asp:Panel>
    </ItemTemplate>
</asp:TemplateField>

i have a Bootstrap-Navbar on a ASP-Page. The Navbar ist included in a MasterPage and working fine with all the sites in root-Directory.

Some Pages with Login-Functionality are in an admin-Folder. These Pages use the same MasterPage, but when beeing on such a page, the Navbar isn't collapsing when clicking on a MainMenu-Item. The only thing that happens, is in the adress-box in the browser is a "#" appearing at the end.

Can someone help me solving this Problem ?

Greetings Gregor

<nav class="navbar navbar-fixed-top" role="navigation" style="background-color:#286090;width:100%;z-index:10;">
                <div class="container">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar" style="background-color:white;width:50px;height:5px;padding:4px;margin:5px;"></span>
                            <span class="icon-bar" style="background-color:white;width:50px;height:5px;padding:4px;margin:5px;"></span>
                            <span class="icon-bar" style="background-color:white;width:50px;height:5px;padding:4px;margin:5px;"></span>
                        </button>
                    </div>
                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav">
                            <li><a href="../default.aspx" style="color:white;font-size:5em;margin-left:30px;"><i class="fa fa-home"></i></a></li>
                            <li>
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color:white;font-size:3em;margin-left:30px;padding-top:50px;">Serien</a>
                                <ul class="dropdown-menu multi-level">
                                    <li><a href="../tagebuch.aspx" style="color:white;background-color:#286090;font-size:3em;">Serien-Diary</a></li>                                                           
                                    <li><a href="../tagebuch.aspx?unbeendete=ja" style="color:white;background-color:#286090;font-size:3em;">Nicht-Beendete</a></li>
                                    <li><a href="../tagebuch.aspx?todo=ja" style="color:white;background-color:#286090;font-size:3em;">Warteliste</a></li>
                                    <li><a href="../admin/sichtungTV.aspx" style="color:white;background-color:#286090;font-size:3em;">Serien-Sichtung anlegen</a></li>
                                    <li><a href="../admin/logoUpload.aspx" style="color:white;background-color:#286090;font-size:3em;">Serien-Logo hochladen</a></li>
                                    <li><a href="../neueste.aspx?serien=true" style="color:white;background-color:#286090;font-size:3em;">DB Chronologie</a></li>                                    
                                    <li><a href="../neueste.aspx?chrono=true" style="color:white;background-color:#286090;font-size:3em;">Sichtungs-Chrono</a></li>
                                    <li><a href="../admin/serienDaten.aspx" style="color:white;background-color:#286090;font-size:3em;">Serien-Daten</a></li>
                                    <li><a href="../empfehlungen.aspx?serien=true" style="color:white;background-color:#286090;font-size:3em;">Empfehlungen</a></li>
                                </ul>
                            </li>
                            <li>
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color:white;font-size:3em;margin-left:30px;padding-top:50px;">Filme</a>
                                <ul class="dropdown-menu multi-level">
                                    <li><a href="../letzteFilmsichtungen.aspx" style="color:white;background-color:#286090;font-size:3em;">Film-Diary</a></li>
                                    <li><a href="../admin/eintragen.aspx" style="color:white;background-color:#286090;font-size:3em;">in DB anlegen</a></li>
                                    <li><a href="../neueste.aspx" style="color:white;background-color:#286090;font-size:3em;">DB Chronologie</a></li>
                                    <li><a href="../admin/sichtungFilm.aspx" style="color:white;background-color:#286090;font-size:3em;">Film-Sichtung anlegen</a></li>
                                    <li><a href="../empfehlungen.aspx" style="color:white;background-color:#286090;font-size:3em;">Empfehlungen</a></li>
                                    <li><a href="http://filmliste.gregormannek.de" style="color:white;background-color:#286090;font-size:3em;">Liste Filtern</a></li>
                                    <li><a href="../empfehlungen.aspx?quelle=dvd" style="color:white;background-color:#286090;font-size:3em;">DVD's</a></li>
                                    <li><a href="../empfehlungen.aspx?quelle=bluray" style="color:white;background-color:#286090;font-size:3em;">BluRay's</a></li>
                                    <li>
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color:white;background-color:#286090;font-size:3em;">FILTERN<b class="caret"></b></a>
                                    <ul class="dropdown-menu">
                                        <li>
                                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color:white;background-color:#286090;font-size:3em;">FSK</a>
                                            <ul class="dropdown-menu">
                                                <li><a href="../empfehlungen.aspx?filter=beschlagnahmt" style="color:white;background-color:#286090;font-size:3em;">Beschlagnahmen</a></li>
                                                <li><a href="../empfehlungen.aspx?filter=spio" style="color:white;background-color:#286090;font-size:3em;">SPIO/JK</a></li>
                                                <li><a href="../empfehlungen.aspx?filter=aliste" style="color:white;background-color:#286090;font-size:3em;">Liste A</a></li>
                                                <li><a href="../empfehlungen.aspx?filter=bliste" style="color:white;background-color:#286090;font-size:3em;">Liste B</a></li>
                                            </ul>
                                        </li>
                                        <li>
                                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color:white;background-color:#286090;font-size:3em;">Genre</a>
                                            <ul class="dropdown-menu">
                                                <li><a href="../empfehlungen.aspx?genre=splatter" style="color:white;background-color:#286090;font-size:3em;">Splatter</a></li>
                                                <li><a href="../empfehlungen.aspx?genre=horror" style="color:white;background-color:#286090;font-size:3em;">Horror</a></li>
                                                <li><a href="../empfehlungen.aspx?genre=action" style="color:white;background-color:#286090;font-size:3em;">Action</a></li>
                                                <li><a href="../empfehlungen.aspx?genre=scifi" style="color:white;background-color:#286090;font-size:3em;">Science-Fiction</a></li>
                                                <li><a href="../empfehlungen.aspx?genre=fantasy" style="color:white;background-color:#286090;font-size:3em;">Fantasy</a></li>
                                            </ul>
                                        </li>
                                    </ul>
                                    </li>
                                </ul>
                            </li>
                            <li>
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color:white;font-size:3em;margin-left:30px;padding-top:50px;">Sonstiges</a>
                                <ul class="dropdown-menu multi-level">
                                    <li><a href="../admin/einstellungen.aspx" style="color:white;background-color:#286090;font-size:3em;">Einstellungen</a></li>
                                    <li><a href="../protokoll.aspx" style="color:white;background-color:#286090;font-size:3em;">Protokoll</a></li>
                                    <li><a href="../default.aspx" style="color:white;background-color:#286090;font-size:3em;">HOME</a></li>
                                </ul>
                            </li>
                            <li><a href="#oben" style="color:white;font-size:5em;margin-left:50px;"><i class="fa fa-hand-o-up"></i></a></li>
                        </ul>
                    </div>
                    <!-- /.navbar-collapse -->
                </div>
                <!-- /.container -->
            </nav>