Am making a Plugin architecture application using Asp.Net MVC 5 so I created a class library project that will contains some controllers and some embedded Razor views. everything works fine i made some references to the followingDlls `System.Web.Mvc/System.Web.Optimazations/System.Web.Razor/System.Web.WebPages/System.Web.WebPages.Razor/System.Web.helpers.

I added a web.config file and this is what it contains :

<?xml version="1.0"?>

<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />

        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="Plugin_1" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.5.2" >


    </compilation>

    <httpRuntime targetFramework="4.5.2" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="Plugin_1" />
        <add namespace="Kendo.Mvc.UI"/>
      </namespaces>
    </pages>
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>
  </system.web>

  <system.webServer>
    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>
</configuration>

I can use the @model keyword etc but i cannot use html helper like "@Html.ActionLink() etc , @Html is not recognized to vs 2015 !! Can any one help me please i've seen some similar questions here on StackOF but it doesnt help. and Thank you.

In a Razor view (time) card/sheet, how do I display model info, in two directions.

My @model: HoursByDay contains int Day/Hrs worked & Project Name,

  1. How to display IEnumerable<HoursByDay> horizontally: show Days/hours horizontally IEnumerable<HoursByDay>, one week, 7 Days/per row, at a time? with projects & activites vertically on the side,
  2. How to save all the hours on Submit? - and POST all the corresponding user input

Collection of Days IEnumerable<HoursByDay> across the top [Mon] [Tue] [Wed].. PetVolunteer - Copy.png


Controller

[HttpPost]
public void SubmitWeeklyTime(IEnumerable<HoursByDay> hoursWorkedForWeek, ProjectName onProject){
// save all days, with hours and project
}

Model

public class HoursByDay // for e.g. Store Monday [8 hrs], Tue [6 hrs], hours worked..
{
    public int hrsId { get; set; }
    public datetime dateWorked { get; set; }
    public decimal hoursworkedOnthatDate { get; set; } 
    public decimal TotalHours { get; set; }
    public bool Billable { get; set; } 
    public List<ProjectName> projectList;
    public List<ActivityName> activityList;
}

public class ProjectName
{
    public int prjId { get; set; }
    public string pName { get; set; }
    public string Comment { get; set; }    
    public ProjectName(string name, int prjId )
    {   this.pName = name;
        this.prjId = prjId; }
}

I've been working on a .net core web application for about 3 months now. With the release of VS2017, I thought I'd pull it down this weekend to try out the auto migration it has as well as the new enviro. When I did this, all went well with the exception of the System.Net.Http reference.

I'm receiving an error that states;

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1956,5): warning MSB3243: No way to resolve conflict between "System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1>Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [C:\Users\reamj\.nuget\packages\microsoft.net.http\2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll] to Version "4.1.1.0" [C:\Users\reamj\.nuget\packages\system.net.http\4.3.0\ref\netstandard1.3\System.Net.Http.dll] to solve conflict and get rid of warning.

Being that this is within the dll, I'm really not sure how to resolve the issue. It would be nice to resolve this to leverage VS17. Any help is greatly appreciated! Below is my csproj (no longer project.json) configuration.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.0</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>ProjectName</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>ProjectName</PackageId>
    <UserSecretsId>noooooooooooooooooooope</UserSecretsId>
    <RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <Content Update="wwwroot\**\*;**\*.cshtml;appsettings.json;web.config">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0-msbuild3-final">
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0-msbuild3-final">
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>
    <PackageReference Include="SendGrid.NetCore" Version="1.0.0-rtm-00002" />
   
    <PackageReference Include="MailKit" Version="1.10.2" />
    
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
    <PackageReference Include="WindowsAzure.Storage" Version="8.1.0" />
    <!--<PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2016.3.1118" />-->
    <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.3" />
  </ItemGroup>

  <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command="bower install" />
    <Exec Command="dotnet bundle" />
  </Target>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild3-final" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
  </ItemGroup>

</Project>

I am trying to setup a custom 404 error page. In my web.config I have this in my system.web

<customErrors mode="RemoteOnly">
      <error statusCode="404" redirect="~/Home/Error404" />
    </customErrors>

I have this method in my HomeController

public ActionResult Error404()
        {
            return View();
        }

and this my view

@{
    ViewBag.Title = "Error404";
}

<h2>Error404</h2>

My problem is when I goto the URL that does not exist in my website, I do not get my custom page. Is there something I am missing?

I have built and application in angularjs (using angular routing feature) which calls web api services for CRUD operations. Everything works fine when i run the application from visual studio. When I deploy the application on IIS web server script files do not load as they are searched in path which is prefixed by application name. Start up page of my application is Index.html which has following code to load scripts.

<title></title>
<base href="/" />
<meta charset="utf-8" />
<script src="/Scripts/angular.min.js"></script>
<script src="/Scripts/angular-route.min.js"></script>
<script src="/Scripts/app.js"></script>
<script src="/Scripts/xeditable.js"></script>
<link href="/css/xeditable.css" rel="stylesheet" />
<link href="/Content/bootstrap-theme.css" rel="stylesheet" />
<link href="/Content/bootstrap.css" rel="stylesheet" />

When i run the application after hosting on IIS I see files are not loading as below:

script issue

My application url is http://localhost/RoutingSample/index.html

so if change index.html to add application name script files load properly.

<title></title>
<base href="/" />
<meta charset="utf-8" />
<script src="/RoutingSample/Scripts/angular.min.js"></script>
<script src="/RoutingSample/Scripts/angular-route.min.js"></script>
<script src="/RoutingSample/Scripts/app.js"></script>
<script src="/RoutingSample/Scripts/xeditable.js"></script>
<link href="/RoutingSample/css/xeditable.css" rel="stylesheet" />
<link href="/RoutingSample/Content/bootstrap-theme.css" rel="stylesheet" />
<link href="/RoutingSample/Content/bootstrap.css" rel="stylesheet" />

my question is - is there any way of configuring in IIS so that I don't need to modify all html files to add this application name before file paths?

I'm hoping that someone could help me figure out what is going on with a .net core web-api application that I have been writing - I've spent a whole day attempting to debug this and it's driving me crazy.

The server application is written in c# using asp.net core 1.1 under VS 2017 RC. I have a controller for accepting a post which will return a simple object. For reference, the basic controller class looks like the following :

    [HttpPost]
    public IActionResult Create([FromBody] websiteOrder myOrder)
    {
        return StatusCode(201, new ObjectResult( OrderRepos.Add(myOrder)));
    }

I am using a JQuery ajax() call at the client, as follows :

$.ajax({
        url: myURL+"prices",
        type: 'POST',
        dataType: 'json',
        contentType: 'application/json; charset=utf-8',
        data:JSON.stringify(myCart),
        async: true,
        success: function (data) {
        ...
        },
        error: function (textStatus, errorThrown) {
        ...
        }

This work FINE most of the time. However I notice that certain orders were causing the ajax() call to error with a 400 Bad Response. On finally tracking this down it come down to the presence or not of a '£' (UK Pound) symbol within the MyCart data. If the £ is present then it errors. If I switch the £ for a $ sign then it works fine.

The 'stringified' JSON for the good and bad versions of data are as follows :

This works:

[{\"sku\":\"WA01GMT\",\"num\":1,\"price\":\"$180.00\",\"desc\":\"Watch 01 - Gunmetal with tan strap\",\"cCode\":\"GB\"}]"

This doesn't work:

[{\"sku\":\"WA01GMT\",\"num\":1,\"price\":\"£180.00\",\"desc\":\"Watch 01 - Gunmetal with tan strap\",\"cCode\":\"GB\"}]"

The only difference I can see is the £ character. I was under the impression that all ajax() calls were utf-8 by default. Am I missing something obvious around encoding or locale? I have considered (briefly) encodeURIComponent() etc. but this is POST rather than a GET and my understanding is that this should be encoded correctly by default?

BTW when the error occurs nothing is triggered at the server side as I have a breakpoint watching on the controller. The server and client are both running on the same local machine using IIS.

Any thoughts / guidance would be very gratefully received.

In my custom grid editor I have a media picker which selects and image and a content picker which selects a node from the tree.

The desired output is this:

<a href="@Model.value.linkUrl">
    <img src="@url" alt="@Model.value.caption">
</a>

if I choose an image and hit save, the image displays as it should on the web page.

If i select the link button and pick a 'node' from the tree, the image disappears from the back office and the resulting code is

<a href="3020">
    <img alt="@Model.value.caption">
</a>

As you can see, it's set the link url in the a href:

My code is as follows:

editor.controller.js

// Media Picker

angular.module("umbraco").controller("emailMediaPicker.controller",       function ($scope, $rootScope, $timeout, dialogService) {

$scope.setImage = function () {

    dialogService.mediaPicker({
        startNodeId: $scope.control.editor.config && $scope.control.editor.config.startNodeId ? $scope.control.editor.config.startNodeId : undefined,
        multiPicker: false,
        cropSize: $scope.control.editor.config && $scope.control.editor.config.size ? $scope.control.editor.config.size : undefined,
        showDetails: true,
        callback: function (data) {

            $scope.control.value = {
                image: data.image
            };

            $scope.setUrl();
        }
    });
};

$scope.setUrl = function () {

    if ($scope.control.value.image) {
        var url = $scope.control.value.image;

        if ($scope.control.editor.config && $scope.control.editor.config.size) {
            url += "?width=" + $scope.control.editor.config.size.width;
            url += "&height=" + $scope.control.editor.config.size.height;

            if ($scope.control.value.focalPoint) {
                url += "&center=" + $scope.control.value.focalPoint.top + "," + $scope.control.value.focalPoint.left;
                url += "&mode=crop";
            }
        }
        $scope.url = url;
    }
};

 //Set image link

$scope.setImageLink = function () {
    $scope.control.value = { linkUrl: "linkUrl" };
    console.log("Before linkUrl =" + $scope.control.value.linkUrl);
    dialogService.contentPicker({
        startNodeId: $scope.control.editor.config && $scope.control.editor.config.startNodeId ? $scope.control.editor.config.startNodeId : undefined,
        multiPicker: false,
        showDetails: true,
        callback: function (node) {             
            $scope.control.value = {
                id: node.id
            };
            $scope.control.value.linkUrl = node.id;
        }


    });

};

$timeout(function () {
    if ($scope.control.$initializing) {
        //$scope.setImage();
    } else {
        $scope.setUrl();
    }
}, 200);
});

view page .html

<div ng-controller="emailMediaPicker.controller">
<div class="umb-editor-placeholder" ng-click="setImage()" ng-if="control.value === null">
    <i class="icon icon-picture"></i>
    <div ng-id="!control.$inserted" class="help-text"><localize key="grid_clickToInsertImage">Click to insert image</localize></div>
</div>
<div ng-if="control.value">

<!--This is the media picker-->
    <img ng-if="url" ng-click="setImage()" ng-src="{{url}}" ng-model="control.value.image" class="fullSizeImage" />

    <!--This is the link picker-->
    <button ng-click="setImageLink()" ng-model="control.value.linkUrl">{{control.value.linkUrl}} - Selected</button>

</div>
<umb-overlay ng-if="mediaPickerOverlay.show"
             model="mediaPickerOverlay"
             view="mediaPickerOverlay.view"
             position="right">
</umb-overlay>

</div>

Thanks for your help. :)

I have the following markup in my Create view for model EmployeeBindingModel:

<div asp-validation-summary="All" class="text-danger"></div>
<input type="hidden" asp-for="EmployeeId" />

If I leave the stupid scaffolded Create action as is, it passes a null model to the view, despite the controller being typed for EmployeeBindingModel. Then on submit, the client side validation doesn't work at all, but that is the subject of another question.

This question is why does the controller's model validation only return the following message, without a property name, for EmployeeId?

The value '' is invalid.

I found that this code would make my page remain at the same position if I refresh the page.

var xPos, yPos;
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
    xPos = $get('scrollDiv').scrollLeft;
    yPos = $get('scrollDiv').scrollTop;
}
function EndRequestHandler(sender, args) {
    $get('scrollDiv').scrollLeft = xPos;
    $get('scrollDiv').scrollTop = yPos;
}

However the result is not the same when the page reloads due to form post, is it possible to fix this and make it work for both situations?

I have hosted a ASP.NET WebApi application w/ Angular2 in the front end on godaddy.

On the server I have enabled: Go Daddy Settings

My web.config in the web.api project looks like this:

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5.2" />
      </system.Web>
  -->
  <system.web>
    <trust level="Full" />
    <customErrors mode="Off" />
    <authentication mode="None" />
    <compilation targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthentication" />
    </modules>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

AFTER couple minutes of the application working.. I always get the following login prompt.

Login Prompt

I have tried adding <identity impersonate="true"/> but that didn't do anything.

What am I doing wrong here?

encrypt email and store in database by using sql server now I want to fetch that email and decrypt it then want to show in grid view please give me some solution of my problem

This is my checkBoxList:

<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatColumns="2" Style="float: left; font-size: large;"></asp:CheckBoxList><br />

When i select an item and press the button i gets an error System.IndexOutOfRangeException

I use this line to show selected item

 System.Diagnostics.Debug.WriteLine(CheckBoxList1.SelectedValue[0])

Thank you!

This is my test

I've got a webservice which provide my app from data. Currently I've got issues with dates.

In my Ionic pages i use the date pipe like this: {{model.DateStart | date: 'dd-MM-yyyy HH:mm'}}

This results in '18-02-2017 14:08', thats good.

But when the service sends this '2017-02-18T15:00:00' the result is '18-02-2017 16:00'. That's not good.. It adds a hour somewhere.

It'll have to do with the locale settings somewhere, but I don't know how to fix it.

Anyone knows how to fix this problem?

medicinecenterlist = (List)Session["medicinecenterlist"]; this session has multiple value and MedicineCenter is a moddel and have many property. Now My view page or View template how i fetch/show/retrive all multiple data or array of data in List Box.

i am trying to add the default button functionality for the table each row. in each templates of the list view like Insert template and Edit template.

One way i know is using asp Panel but how will add the panel in each row of the table to get the functionality working and if not panel then what will be the other way of achieving it.

Please help as its very basic requirement from the application which we are stuck with the tables.

I got this error in visual studio 2015 while publishing asp.net.core web app to azure.

The "Publish" task failed unexpectedly. System.Exception: Publishing WebApplication1 for .NETFramework,Version=v4.6.2/win7-x64

Illegal characters in path. Parameter name: path at Microsoft.DotNet.Tasks.Publish.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuild.

the project builds on local machine and launched the web app successfully but fails to deploy on azure.

I am trying to create an ASP.NET MVC Web API project using entity framework

I'm not sure where to start,based on your experience can anyone point to web tutorials I can look up to get started?anyone give me a hand?

If this is not the right forum,where should I post questions like these

So, I've seen this solution (http://www.hanselman.com/blog/HowToEnableHTTPStrictTransportSecurityHSTSInIIS7.aspx) used in other answers and other sites, but I don't understand HOW the HSTS header is being added. I assume it has a lot to do with this:

<match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />

Could someone explain where "RESPONSE_Strict_Transport_Security" is coming from?

Full code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="HTTP to HTTPS redirect" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
                        redirectType="Permanent" />
                </rule>
            </rules>
            <outboundRules>
                <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
                    <match serverVariable="RESPONSE_Strict_Transport_Security"
                        pattern=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="on" ignoreCase="true" />
                    </conditions>
                    <action type="Rewrite" value="max-age=31536000" />
                </rule>
            </outboundRules>
        </rewrite>
    </system.webServer>
</configuration>

I am a total .net beginner and just starting in the world of web development, but I do have a fair amount of database and backend experience using mostly non Microsoft technologies. I'm looking for an example of a current (preferably free) C#.net application template that I can use to do the following:

  1. Display a list of records from a record set in a read only grid on a main webpage.

  2. When the user clicks on a single record/row in the grid, a separate add/edit detail page will be displayed for the record with controls to match the data types of the fields (textboxes, date pickers, etc.)

  3. The user can edit the individual fields on the detail page and click a cancel or save button to update the record and return to the main page

I know this is painfully simple to most of you, but to a noob who is just starting, it's difficult to weed through the many online resources and find a good simple working complete example. Any advice? Thank you!

i am using owin middleware for authentication. I am using 3 middleware extensions eg bearer, custom1, custom2.

After authentication has happened, I want to know in my authhorization code, which of the middleware extension was successful in authenticating. I tried to achieve it by inserting a property in AuthenticationTicket

 Dictionary<string, string> statevalues = new Dictionary<string, string>() { { "successful", "true" } };
AuthenticationProperties props = new AuthenticationProperties(statevalues);
AuthenticationTicket authenticationTicket = new AuthenticationTicket(claimsIdentity, props);

But I couldn't find how to read back these properties. They were not available in HttpContext.Current.GetOwinContext().Authentication.GetAuthenticationTypes() also.

Any idea?

I dont understand the error message. What does it mead by scalar variable? @ASIN value should be stored in the id variable I created for the GetByAsin method.

 //Gets one Music Detail
    public MusicDescriptionModel GetByAsin(string id) 
    {
        using (IDbConnection db = connection)
        {
            string sql = "select ASIN, Title, Artist, Price, ReleaseDate,NumberDisks,label,DetailPageURL, Review" +  
                           "FROM tblDescription WHERE id = @ASIN";
            //need to parameterize ID to avoid sql injection attacks.
            MusicDescriptionModel musicdesc = db.Query<MusicDescriptionModel>(sql, new { id }).SingleOrDefault();
            return musicdesc;
        }
    }