As an experiment I decided to add a list of strings to one of my entity framework classes, I ran 'Add-Migration MultiList' and got the error:

Unable to create an object of type 'MediaEngineContext'. Add an implementation of 'IDesignTimeDbContextFactory' to the project, or see for additional patterns supported at design time.

Removing the list didn't resolve the issue.

Looking online seems like a lot of people had this issue with older versions of .net core and upgrading fixed the issue, not for me so much..

Nothing else changed in my project, not how I start building things or anything like that.

I have an API using .NET Core 2.0. I already have JWT working with roles but I want to move to use it with scopes. I have a defined list of permissions and the idea is to create dynamic roles based on that permissions.

Because roles are dynamic I can't use role-based authentication, so I need to authenticate a user based on permissions.

JWT Example:

  "iat": 1416929061,
  "jti": "802057ff9b5b4eb7fbb8856b6eb2cc5b",
  "scopes": {
    "users": {
      "actions": ["read", "create"]
    "users_app_metadata": {
      "actions": ["read", "create"]

The only solution is to create policies for every scope? How can I achieve this?

An example is available here:

I am using

  • autofac.signalr2 v4.0.0
  • microsoft.aspnet.signalr 2.2.2
  • .net framework 4.6.1

using the owinstartup to deliver an IObservable to my hub all good (AFAICT)

However in my JavaScript and .NET client I see a issue where:

  1. start 1st client - successful start(). get no messages (no successful call to my javascript callbacks)
  2. start 2nd client - now the 1st client starts to work, 2nd client gets no messages
  3. start 3rd client - now 1st, 2nd client work, 3rd gets no messages

Here's a message the 2nd client was sent (when it was not working)

Sending outgoing message. Connection id: 12e1a17f-5f48-4e66-aece-166957d645cf, transport: WebSocketTransport, 
message: {"C":"d-142AA7E2-B,0|J,0|K,2|E,B3","M":[]}

then after the 3rd client is connected 2nd client gets this (which does work):

Sending outgoing message. Connection id: 12e1a17f-5f48-4e66-aece-166957d645cf, transport: WebSocketTransport, 
message: {"C":"d-142AA7E2-B,0\|J,0\|K,2\|E,B4","M":[{"H":"StreamHub","M":"receiveCallCanceled","A":[{"BaseTime":717006987,"BedIndex":2,"CallIndex":4,"EscalationIndex":5,"CallPlacedUTCTime":"2017-09-20T04:52:12.9831051Z","ServerSentUTCTime":"2017-09-20T04:52:15.4492756Z","FacilityGuid":"11111111-1bad-f00d-1111-111111111111","DialString":"1*111"}]}]}

notice that the connectionid is the same It appears that the "M":[] is the reason the client isn't receiving the callbacks. Whats causing this?


builder.Register(c =>
                    return new PCConsoleStreamObservable(c.Resolve<IClientGrainFactory>(),
                catch (Exception ex)


            var hubConfiguration = new HubConfiguration()
            //EnableJavaScriptProxies = true,
            //EnableJSONP = false,
            EnableDetailedErrors = true,
            Resolver = new Autofac.Integration.SignalR.AutofacDependencyResolver(container)



        app.Map("/signalr", map =>


public class StreamHub : Hub
    private readonly IObservable<XXXClientBase> _observer;

    public StreamHub(IObservable<XXXClientBase> observer) : base()
        this._observer = observer;

We have an ASP.NET Web Forms application which uses Forms Authentication.

In Visual Studio, unlike class library projects, if you make changes to the main website project (i.e. ASPX pages), you don't have to recompile your entire solution to test your results in the browser. You simply save your changes, and refresh the browser.

In our situation, after making a single change, we save and refresh the browser, and everything works fine. However, after 6th or 7th or 8th change, we get logged out. There is a long (5 min) delay of browser trying to refresh just to get back to the login screen.

I tried Googling, but not finding any relevant information. Does anyone know what can be causing this or point me in the right direction?

Thanks in advance.

I am facing some problems deploying my project . In my work , I have been asked to create a site . the previous one is located inside public Drive .E:\all\**site**\index.html where everyone could navigate to to view the site. What files exactly should i move to the folder ? I tried to copy all project folder but what will be my navigation path ? i tried even with \controllerName but i still getting Server Error in '/' Application. Runtime Error in the browser.

(I have to say that there is no problem navigating to *.html files .)


I'm trying to scrap some data using this code.

tables <-  readHTMLTable('')
str(tables, max.level = 1)
df <- tables$searchResults

It works perfect but the problem is that it only gives me data for the first 188 observations that corresponds to the players whose position is "Base". Whenever I try to get data from "Pivot" or "Alero" players, it gives me the same info. Since the url never changes, I don't know how to get this info.

I have a webform with a checkbox in it. I need to do two things differently based on an environment setting.

  1. Add a class
  2. Add the Text attribute so a label gets created

                            <% if setting == true) { %>
                            <asp:CheckBox ID="optionCheckbox" class="option-checkbox radio-checkbox" runat="server" Text="Label Text"/>
                            <% } else { %>
                            <asp:CheckBox ID="optionCheckbox" class="option-checkbox" runat="server"/>
                            <% } %>

The problem with this is the page won't render because the ids are the same, even though only one could ever get rendered. There is a lot of other processing with javascript and such so I don't want different ids for each scenario.

I am a beginner in ASP.Net MVC 5 web development. And I am stuck at one place where I need to apply email address validation only when a certain Model Property bool value is true.

Raw code:

    [Display(Name = "Email")]
    [Required(ErrorMessage = "The email address is required")]
    [EmailAddress(ErrorMessage = "Invalid Email Address")]
    public string Email { get; set; }

Modified Code:

// Bool Model Property   
public bool IsMoveIn{get;set;} 
[Display(Name = "Email")]
public string Email { get; set; }

Custom Validation:

public class IsMoveIn: ValidationAttribute
    public override bool IsValid(object value)
        // Pseudo Code
        //if(Model.IsMoveIn is TRUE)
          //  apply [Required] on Email Property validation and return true/false accordingly
        //else //do nothing


  1. I know about FoolProof Validation but I don't want to use that.

  2. I am okey with server side validation. I can ignore client side validation.

If isMoveIn is False I want ModelState.IsValid to be always true even though user has not put any email address.

Please guide me on how to proceed.

I have the following code

@{var sortedNotes = Model.EBNotes.OrderBy(i => i.DateCreated).ToList();

    foreach (var note in sortedNotes)   
        @if (note.Profile == null)
            <td>Migration Note</td>
            <td>@note.Profile.FirstName @note.Profile.LastName</td>
        <td><button type="button" value="@note.Id" class="btn btn-info noteCopy">Copy Note</button></td>


It is working in that it outputs the data but it completely ignores the OrderBy clause, ie the data is not sorted by date.

Any ideas what is wrong?

I am including: @using System.Linq.Dynamic.Core;

(DateCreated is a DateTime)


Edit - Actual Output Below:

02/05/2017 10:18:35 Migration Note Account is currently being worked Copy Note
09/08/2017 11:34:51 Donna NONE genuine as this has since been reversed Copy Note
10/08/2017 08:56:59 Donna NONE genuine as this has since been reversed Copy Note
13/07/2017 11:44:30 Migration Note  Copy Note

I'm working on an asp .net project. I need to globalize it so I followed a tutorial (I'm a junior dev) on (This one). I got a problem with the tutorial but after some searchs I resolve it. Currently, I got 2 links :


What I would like to do is to have flags instead of text. So, I want to add a class to the '< a >' element and put a background image. But when I add the class, the link generated by the Html.Helper is becoming strange. Some parameters are added, I don't understand why.

EDIT : I forgot to write that links doesn't change language when I add the class.

URLs before I add class to a link

<a href="/en">English</a>
<a href="/">[Français]</a>

URLs after I add class to a link

<a href="/?Count=6&amp;Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object%5D&amp;Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D">English</a>
<a class="drapeauFrance" href="/?Count=6&amp;Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object%5D&amp;Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D">[Français]</a>

How I include links to my partial view

@using MIFA.Helpers
@Html.LanguageSelectorLink("en", "[English]", "English", null)
@Html.LanguageSelectorLink("fr", "[Français]", "Français", new { @class = "drapeauFrance" })

How the LangageSelectorLink works

public static MvcHtmlString LanguageSelectorLink(this HtmlHelper helper, string cultureName, string selectedText, string unselectedText, object htmlAttributes, string languageRouteName = "lang", bool strictSelected = false)
    var language = helper.LanguageUrl(cultureName, languageRouteName, strictSelected);
    var link = helper.RouteLink(language.IsSelected ? selectedText : unselectedText, "LocalizedDefault", language.RouteValues, htmlAttributes);
    return link;

How LangageUrl works

public static Language LanguageUrl(this HtmlHelper helper, string cultureName, string languageRouteName = "lang", bool strictSelected = false)
    cultureName = cultureName.ToLower();
    var routeValues = new RouteValueDictionary(helper.ViewContext.RouteData.Values);
    var queryString = helper.ViewContext.HttpContext.Request.QueryString;
    foreach (string key in queryString)
        if (queryString[key] != null && !string.IsNullOrWhiteSpace(key))
            if (routeValues.ContainsKey(key))
                routeValues[key] = queryString[key];
                routeValues.Add(key, queryString[key]);
    var actionName = routeValues["action"].ToString();
    var controllerName = routeValues["controller"].ToString();
    routeValues[languageRouteName] = cultureName;
    var urlHelper = new UrlHelper(helper.ViewContext.RequestContext, helper.RouteCollection);
    var url = urlHelper.RouteUrl("LocalizedDefault", routeValues);
    var current_lang_name = Thread.CurrentThread.CurrentUICulture.Name.ToLower();
    var isSelected = strictSelected ? current_lang_name == cultureName : current_lang_name.StartsWith(cultureName);
    return new Language()
        Url = url,
        ActionName = actionName,
        ControllerName = controllerName,
        RouteValues = routeValues,
        IsSelected = isSelected

I'm asking your help to understand why the URL is changed when I add html attributes.

I tried to understand the function 'LanguageUrl' because to my mind the problem is here but my knowledge are too weak to understand it or to understand the htmlAttributes's impact on URL.

If I made some english mistakes, please tell me I will edit my question.

Thank you in advance for your answers.

On my view I have a dropdownlist and a hidden listbox.

@Html.ValidationSummary(false, "", new { @class = "text-danger" })

<div class="form-group">
    @Html.Label("Assets:", new { @class = "control-label col-md-2" })
    <div class="col-md-10">
        @Html.DropDownList("Assets", null, "-- Select an Asset --", new { id = "Asset-Tags", @class = "form-control" })

@Html.ListBoxFor(model => model.AssetsList, new List<SelectListItem>(), new {id = "AssetTags", @class = "form-control"})

AssetsList is required. Assets is just a basic dropdown that I am using to fill the listbox and has no relation to the model. Since that listbox is hidden, I am filling it via jQuery.

    function(evt) {
            .append("<option selected='true' value='" + + "'>" + + "</option>");
        $("#Asset-Tags option[value='" + + "']").remove();

Now since, AssetsList is required.. if nothing is populated inside the listbox, and a user clicks the create button.. jQuery validation fires off and doesn't allow the user to submit the form. I am showing my errors via the ValidationSummary at the top of the form, but the dropdownlist is not getting highlighted in a red outline via input-validation-error class that gets applied. I know this is because the dropdownlist is not a part of the model, but is there way so that when the jQuery validation fires off because AssetsList is empty.. the dropdownlist gets highlighted with the css class input-validation-error?

Any help is appreciated.

I have a little problem. I use mvc 5 and want to generate a DropdownlistFor by razor in javascript:

function addRowIndikator() {
        var table = document.getElementById("tb_1");
        var count = table.rows.length;
        var row = table.insertRow(count - 2);
        var cell1 = row.insertCell(0);
        cell1.innerHTML = "3";
        cell1.colSpan = 3;
        var cell3 = row.insertCell(1);
        cell3.innerHTML = @if (Model._LIndikator != null)
                              @Html.DropDownListFor(m => m._Indikator.Id, new SelectList(Model._LIndikator, "Id", "Name"), new {id = "selectIndi"})
                                     <option>Keine Indikatoren vorhanden</option>

But it doesn't work. Have someone an idea?

I want to deploy my website with precompiled views, for performance reasons. So I have configured UseMerge and PrecompileBeforePublish.

This is part of my publishing profile:


In the UI this is reflected:


My Conwell.Administration.Views.dll gets successfull created. However after publishing, I have for each View an additional .precompiled file in my bin folder:

*.compiled files

The content reads as following:

<?xml version="1.0" encoding="utf-8"?>
<preserve resultType="2" virtualPath="/Areas/Bookings/Views/SepaDebits/Detail.cshtml" hash="fffffffff9d57aef" filehash="1737cd4f2d0e" flags="110000" assembly="Conwell.Administration.Views" type="ASP._Page_Areas_Bookings_Views_SepaDebits_Detail_cshtml">
    <filedep name="/Areas/Bookings/Views/SepaDebits/Detail.cshtml" />

I tried to simple delete them, but then the website shows only a blank page. I don't like that many *.compiled files. They add up to more than thousand.

For what are they used? ViewEngine? Is it somehow possible to disable them? Maybe a custom ViewEngine?

I have only found this thread so far, but it doesn't give any pointers.

I have a repeater and inside the repeater a radiobutton control, in code behind I fill the groupname for the radiobutton control, so, when I run it, I have a table with many rows and some of them have radiobutton:

  <asp:updatepanel id="UpdatePanel1" runat="server" updatemode="Conditional">
        <asp:Repeater ID="Repeater1" runat="server" ViewStateMode="Enabled">
                <table class="table table-responsive table-bordered ">
                    <tr class="text-center" style="background-color: #6e6259; color: white;">
                        <th class="text-center">DESCRIPTION</th>
        <td style="padding-left: 20px;">
      <asp:RadioButton ID="rbtDinamic"  OnCheckedChanged="rbtDinamic_CheckedChanged" AutoPostBack="true"
           ViewStateMode="Enabled" Visible="false"  GroupName='<%#Eval("groupvalue") %>'   runat="server"/></td>

And in the itemdatabound of repeater I fill the value for groupname:

  Private Sub Repeater1_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
        If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
            If CType(e.Item.FindControl("hdf1"), Label).Text = False Then
                CType(e.Item.FindControl("rbtDinamic"), RadioButton).Visible = True
                CType(e.Item.FindControl("rbtDinamic"), RadioButton).GroupName = CType(e.Item.FindControl("groupvalue"), Label).Text = False
            End If
        End If
    Catch ex As Exception          
    End Try
End Sub

But when I run it the repeater creates the group name with diferent names:

Radiobutton row 1:

Radiobutton row 2:


So it let checked all the radiobuttons, instead to uncheck when another one for the same group is cheked.

I find this code in a forum, but it work only if I have only one groupname, but I can have more than one groupname:

  Protected Sub rbtDinamic_CheckedChanged(sender As Object, e As EventArgs)
    For Each item As RepeaterItem In Repeater1.Items
        Dim rbtn As RadioButton = DirectCast(item.FindControl("rbtDinamic"), RadioButton)
        rbtn.Checked = False
    DirectCast(sender, RadioButton).Checked = True
End Sub

But there can be more than one group of radiobuttons, so in this case I can't use this code.

Is there anywhere to do this? thanks

I'm experimenting with ASP.NET Core and Docker

I'm trying to build a set of Docker images for a solution that has multiple sites/services

Let's say I have the following solution

  • App
    • Shared lib
    • WebApi
    • WebSite
    • WorkerService

Where WebApi, WebSite and WorkerService each have their own Dockerfile and should result in their own image. They each have a reference to the Share lib project.

From the samples at it is pretty clear how you build a single project without project references

How would you go about writing your Dockerfile when you have project references (Shared lib). I keep running into errors like "Forbidden path outside the build context" when I try to copy files a level above etc.

My guess is I need something on solution level, but I still need individual Dockerfile's for WebApi, WebSite and WorkerService

Can anyone help? Or guide me to a sample somewhere that does this, I have not been able to find one.

At the time of build the WPF project i getting "Error 189 An error occurred while signing: A certificate chain could not be built to a trusted root authority. ..WPF.Web " in error bar.

I Add one .pfx certificate in WPF application and try to build it's throwing error this problem happening only my Desktop but same application i coped in my laptop or other desktop it's successfully build.

Please give me solution it's argent for me.

I am needing to be able to call a javascript function from my MVC 5 controller. However, I am currently using a return in my controller and from what I gathered, you are unable to return 2 things...

The code I currently have is this:

public async Task<FileResult> exportTempBom()
     bool x = await checkExcelFile();            
     string originalDirectory = Path.Combine(new DirectoryInfo(string.Format("{0}App_Data\\", Server.MapPath(@"\"))).ToString(), "downloads");
     byte[] fileBytes = System.IO.File.ReadAllBytes(originalDirectory + "\\BomTemp.xlsx");

     return File(fileBytes, "application/", "BomTemplate.xlsx");

....more code here....

<iframe name="_frameDownload" id="_frameDownload" src="" style="width: 0px; height: 0px; display: none;"></iframe>

As you can see in the code above, I'm already sending back the excel file that the user has requested to download. However, I am needing to call a javascript function either before or after the return of the file to the user.

What I am needing to do is call loadingTheOverlay(false); from the controller AFTER the file has began to download. Calling this will take the overlay off of the page so that the user can continue to navigate the site.

The checkExcelFile() is where I check the excel file that they are about to download to make sure its up to date. If its not then it updates the file before it begins the download. That is why I am in need of the overlay so the user knows why its taking longer than normal to download the excel file.

I am calling that controller with this on the razor page:

 <ul class="dropdown-menu">
     <li>@Html.ActionLink("Download BOM Template", "exportTempBom", "Templates")</li>
     <li>@Html.ActionLink("Download Inventory Template", "exportTempInventory", "Templates", null, new {
        onclick = "loadingTheOverlay(true);",
        target = "_frameDownload"

Is there any MVC code that would do what the original could do?


I'm trying to program an ASP.NET Web API that accepts and then processes text files. The code is almost completely based on the solution Microsoft Docs recommends:

    public async Task<ViewResult> Post(List<IFormFile> files)
        long size = files.Sum(f => f.Length);
        var filePath = System.IO.Path.GetTempFileName();
        String line = "";

        foreach (var formFile in files)
            if (formFile.Length > 0)
                using (var stream = new System.IO.FileStream(filePath, FileMode.Create))
                    await formFile.CopyToAsync(stream);

                    using (System.IO.StreamReader sr = new StreamReader(stream))
                        stream.Position = 0;

                        while ((line = sr.ReadLine()) != null)
                            // ... process the file ...

        return View("Index");

However, when testing the API via Postman (by doing a POST request to localhost:11452/api/values, while attaching a text file), I get the error message 404: Not Found as a result. Note that the GET request to the very same URI (localhost:11452/api/values) works perfectly fine, with "values" being the name of my controller.

What am I doing wrong? I suspect it's either the routing (API can't be addressed under this URI), or or the way I try to upload the file, without marking it as such.

I am a bit new to NAV and so far I have published web services on NAV and have been able to consume these SOAP web services using C#.

Now, the data has increased and its taking longer to load. I have an idea of querying the data in chunks (e.g chunks of 10) using [Datatables][], but this I am yet too figure out how to set limits and offsets.

Here is my C# code to read the NAV soap service

public string getItemCardList(itemCardService_Service itemCardServiceObj, List<itemCardService_Filter> filter)
            serializer.MaxJsonLength = 50000000;
            return serializer.Serialize(itemCardServiceObj.ReadMultiple(filter.ToArray(), null, 0));

I have a slight problem when pop-up is closing; modal-backdrop is not closing.

This code blog for opening pop-up:

    $('div.ProjePartialGovde').click(function (el) {
        var projeid = $(this).data('id');
        $('.popupListe').html('içerik hazırlanıyor...');
            method: "get",
            url: '@Url.Action("ProjeOzetPartial", "Home")',
            data: { projeID: projeid,ilID:@ViewBag.ilID }
            .done(function (msg) {

And this is my pop-up page:

I'm having trouble with my back button. When I clicked back button it goes backwards but there is something gray on the screen wich is: "modal-backdrop in"

<div class="modal" id="detayModal" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                    <div class="form-group">
                        <label class="form-control">Başlangıç / Bitiş Tarihleri: @Model.SozBasTarihi / @Model.SozBitisTarihi</label>
                    <div class="form-group">
                        <label class="form-control">Nakdi ve Fiziki Tamamlanma Oranları: %@Model.NakdiTamOrani / %@Model.FizikiTamOrani</label>
            <div class="modal-footer">

                <!-- I HAVE PROBLEM HERE -->
                <button class="ProjeListesiGeri" data-dissmiss="modal" data-backdrop="false">BACK</button>

<!-- GO BACK CODE -->
    $('.ProjeListesiGeri').click(function (el) {
        $('.popupListe').html('içerik hazırlanıyor...');
            method: "get",
            url: '@Url.Action("ProjelerListesiPartial", "Home")',
            data: { ilID: @ViewBag.ilID }
            .done(function (msg) {