小编Hrv*_*lja的帖子

如何使用AuthorizationHandlerContext访问ASP.NET Core 2基于自定义策略的授权中的当前HttpContext

如何访问当前的HttpContext以检查ASP.NET Core 2中基于自定义策略的授权的AuthorizationHandlerContext内的路由和参数?

参考示例:基于策略的自定义授权

c# .net-core asp.net-core asp.net-core-2.0

12
推荐指数
3
解决办法
6754
查看次数

如何使用TFS服务器在.proj(MSBuild)中获取BuildNumber

我们将TFS 2010与VS 2010一起用于PHP Web项目.实际上我们没有任何.proj或.sln文件,所以我自己做了构建,它看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
    <ItemGroup>
        <ZipFiles Include="**\*.*"/>
    </ItemGroup>

    <Target Name="Zip" >
        <Zip Files="@(ZipFiles)" ZipFileName="$(OutDir)myzip.zip" />
    </Target>

    <Target Name="Build" DependsOnTargets="Zip">
        <Message Text="My Build Complete - $(BuildNumber) - $(TeamProject) - $(BuildProperties)" />
    </Target>
    <Target Name="AfterBuild">
        <MakeDir Directories="Testing" />
        <Message Text="My AfterBuild- $(BuildNumber) "></Message>
    </Target>
</Project>
Run Code Online (Sandbox Code Playgroud)

我已在VS中的构建定义中将构建号配置为"$(BuildDefinitionName)_ $(Date:yyyyMMdd)$(Rev:.r)",并且正确创建了网络路径上的drop文件夹.

问题是$(BuildNumber)或$(TeamProject)或$(BuildProperties)是空的.此外,似乎"我的Afterbuild"从未执行过.

为什么我的变量为空以及如何从指定的构建定义中获取构建号?

msbuild tfs2010

6
推荐指数
1
解决办法
9085
查看次数

在TFS 2013中将TFS项目转换为Git协议

Microsoft Team Foundation Server(TFS)2013支持Git协议.创建TFS项目时,您可以选择将其作为源代码控制的Git或TFS(旧版).我有所有TFS模式的项目,我想使用new-git协议将我的Visual Studio 2013连接到现有的TFS项目,所以我将有其他功能.如何为现有项目实现这一目标?(对于新的,明确的,只需在创建TFS项目时选择选项)

git tfs tfs2013

3
推荐指数
1
解决办法
3672
查看次数

简单的PHP cURL文件上传到Azure存储Blob

我在使用cURL创建新的/简单的PHP脚本/函数时遇到问题,无法使用共享密钥身份验证将简单文件(image.jpg)从本地服务器上传到Azure存储-Blob容器。我不希望(由于其他原因)使用SDK和/或多个文件/库。我只需要一个功能-fileUpload-就是这样。

文档没有提供带有文件覆盖的上载(POST)的完整示例。 https://docs.microsoft.com/zh-cn/rest/api/storageservices/fileservices/authentication-for-the-azure-storage-services

同样不清楚的是,必须具有哪些标头,以及签名/身份验证属性具有哪些标头。(例如,具有不同标题的多个MSDN站点-https: //docs.microsoft.com/zh-cn/rest/api/storageservices/fileservices/put-blob

有人对此想分享一个简单的例子吗?

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
date_default_timezone_set('UTC');

$destinationURL = 'https://mystorage.blob.core.windows.net/blob1/image.jpg';
$accesskey = "qJXTMmw2Esal8/tXgfWk0RLwMNJ6OQKEt0E8EMZ8VhQrzGi5uqJqeKvi1l7iqnOddp7bdtai5rPpC6ynHttl1w==";
$storageAccount = 'mystorage';
$filetoUpload = realpath('./image.jpg');

function upload($filetoUpload, $storageAccount,$destinationURL,$accesskey) {
    $currentDate = date("D, d M Y H:i:s");

    $postFields = array(
        'extra_info' => '123456',
        'file_contents'=>'@'.$filetoUpload
    );

    $headerText=""
        ."x-ms-version: 2015-02-21\n"  
        ."x-ms-date:" .$currentDate." GMT\n"
        ."Content-Type: text/plain; charset=UTF-8\n"  
        ."x-ms-blob-content-disposition: attachment; filename=".$filetoUpload."\n"  
        ."x-ms-blob-type: BlockBlob\n"  
        ."x-ms-meta-m1: v1\n"  
        ."x-ms-meta-m2: v2\n"  
        ;

    $hash = hash_hmac('sha256', $headerText, base64_decode($accesskey), true);
    $sig = base64_encode($hash);

    $headerText.="Authorization: SharedKey ".$storageAccount.":".$sig."\n";
    $headerText.="Content-Length: 280";
    $headers = explode("\n", $headerText);

    $ch …
Run Code Online (Sandbox Code Playgroud)

php curl azure azure-storage azure-storage-files

1
推荐指数
1
解决办法
3032
查看次数