.net-core-rc1

How to get claim inside Asp.Net Core Razor View

让人想犯罪 __ 提交于 2019-12-18 04:34:32
问题 I did it in my rc1 project like: User.Claims.ElementAt(#).Value But after I switched to rtm it wouldn’t work anymore. When I debug the Razor view the object looks the same but User.Claims is just empty. Any idea what the reason could be. 回答1: Assuming you have claims attached to the current principal. In your Razor view: @((ClaimsIdentity) User.Identity) This will give you access to the ClaimsIdentity of the current user. In an effort to keep your claims fetching clean you may want to create

404 on Azure but not on local development machine

元气小坏坏 提交于 2019-12-12 02:43:47
问题 I migrated a MVC project from Asp.net 5 RC1-final to core 1.0.1. On my Development machine everything runs perfect but when I publish it to Azure WebApp I get a 404 on every route. I tried to debug the site and it seems that the View can not be found. Any idea what it could be or how I can get a more detailed error report? 回答1: The Error was that I did not add the Views under publishOption in the project.json. Before: "publishOptions": { "include": [ "wwwroot", "web.config" ] }, Now:

How to manually import the portable profile “portable-net45+win8”?

[亡魂溺海] 提交于 2019-12-12 02:34:45
问题 I am upgrading a .NET solution from .NET Core rc1 to rc2 following the instructions here: http://ef.readthedocs.io/en/latest/miscellaneous/rc1-rc2-upgrade.html In the article it states 'The workaround is to manually import the portable profile “portable-net45+win8”.' Can someone tell me how to manually import this profile please? 回答1: Actually next paragraph contains how to do this. Modify project.json file: { "frameworks": { "netcoreapp1.0": { "imports": ["dnxcore50", "portable-net45+win8"]

VS2015: Adding “watch”: true to tsconfig.json causing JsErrorScriptException (0x30001)

南笙酒味 提交于 2019-12-04 04:46:36
问题 I have created a dummy basic project in VS2015 Community Update 3 , Version 14.0.25424.00. (Using this great tutorial: aspnet-core-web-api-angularjs-2 ). This angular-2 project has some .ts files. The problem: Instead of being transpiled ("compiled") to .js files every time a file is being saved , the .ts files being transpiled once and only at BUILD time of the SERVER-SIDE project. (clicking F5 from visual studio). I google it and found out that I should add "watch": true to the tsconfig

VS2015: Adding “watch”: true to tsconfig.json causing JsErrorScriptException (0x30001)

*爱你&永不变心* 提交于 2019-12-02 01:34:40
I have created a dummy basic project in VS2015 Community Update 3 , Version 14.0.25424.00. (Using this great tutorial: aspnet-core-web-api-angularjs-2 ). This angular-2 project has some .ts files. The problem: Instead of being transpiled ("compiled") to .js files every time a file is being saved , the .ts files being transpiled once and only at BUILD time of the SERVER-SIDE project. (clicking F5 from visual studio). I google it and found out that I should add "watch": true to the tsconfig.json file: { "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": false,