小编max*_*dbe的帖子

outputcache mvc3只注销了用户缓存

有没有办法使用OutputCache属性来缓存仅注销用户的结果并重新评估登录用户示例:

我想要什么

[OutputCache(onlycacheanon = true)]
public ActionResult GetPhoto(id){
   var photo = getPhoto(id);
   if(!photo.issecured){
      return photo...
   }
   return getPhotoOnlyIfCurrentUserHasAccess(id);
   //otherwise return default photo so please don't cache me
}
Run Code Online (Sandbox Code Playgroud)

outputcache asp.net-mvc-3

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

Visual Studio输出窗口中PowerShell输出的宽度

我有一个powershell脚本在输出窗口中运行fxcopcmd.事实证明,当我输出结果时它将输出限制为80个字符,有没有办法让它在visual studio输出窗口中更宽

powershell visual-studio-2008 visual-studio

5
推荐指数
0
解决办法
676
查看次数

切片图片wpf

在WPF我有一个图像,有没有办法申请这些坐标(图像的原生):0,10 20,0 20,20,以选择性地只显示由这些坐标形成的三角形.

根据HB的好建议,我可以使用不透明蒙版,但是我不能正确放置地图,也不能裁剪以适应不透明蒙版.以下示例应该是伊利诺伊州

 <Image Source="http://www.digital-topo-maps.com/county-map/united-states-map.gif" Stretch="None">
    <Image.Clip>
        <PathGeometry>
            <PathFigure StartPoint="444.806216983824,129.344961240310"  IsClosed="True" IsFilled="True">
                <LineSegment Point="445.976759660097,145.147286821705"/>
                <LineSegment Point="431.344976206682,170.313953488372"/>
                <LineSegment Point="447.732573674507,188.457364341085"/>
                <LineSegment Point="458.852729099102,213.038759689923"/>
                <LineSegment Point="469.387613185561,214.209302325581"/>
                <LineSegment Point="481.093039948293,191.383720930233"/>
                <LineSegment Point="479.337225933884,143.391472868217"/>
                <LineSegment Point="477.581411919474,132.271317829457"/>
                <LineSegment Point="444.806216983824,129.344961240310"/>
            </PathFigure>
        </PathGeometry>
    </Image.Clip>
</Image>
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml image

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

OrchardCMS下载到视觉工作室

如果我通过我的托管服务提供商的Microsoft Web App Gallery在服务器上安装了Orchard版本,是否有一个很好的方法来拉下本地Visual Studio开发的果园实例?

orchardcms

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

web.config 单用户基本身份验证

在 nginx 中,我可以创建一个身份验证响应,它发送

WWW-Authenticate:Basic realm="私有网络"

导致在不创建 login.aspx 的情况下弹出单个用户/密码的登录名

这是我的配置设置

<security>
  <authentication  >
    <anonymousAuthentication enabled="true" userName="test" password="test" />
    <!--<basicAuthentication enabled="true" logonMethod="Batch" />-->
    <!--<windowsAuthentication enabled="true" />-->
  </authentication>
</security>

<authentication mode="Forms">
  <forms>
    <credentials passwordFormat="Clear">
      <user name="test" password="test" />
    </credentials>
  </forms>

</authentication>

<location path="." >
    <system.web>
      <authorization>
        <allow roles="admin" />
        <deny users="*"/>
      </authorization>
    </system.web>
</location>
Run Code Online (Sandbox Code Playgroud)

然而,这些设置一直把我带到未写的 login.aspx。

我的目标是为一个用户创建一个简单的 u/p 身份验证,而无需求助于登录页面或更复杂的身份验证。

iis web-config basic-authentication

5
推荐指数
0
解决办法
2662
查看次数

WebAssembly 中是否有 Javascript 运行时

为了安全起见,我正在尝试隔离用户 JavaScript 代码。我可以通过 Iframe 安全性和消息传递来做到这一点。

是否有一个可以通过 WebAssembly 加载的 JavaScript 运行时,我可以向其中传递一些简单的内容(例如“5+3”)并读取结果。

如果这是 c# 等,我可以新建并管理 V8 引擎并让它执行 javascript 并传回主机。

javascript isolation javascript-injection webassembly

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

跨平台C#Media API

我正在尝试在mono/.net对象中定义一个VideoFile,以便我可以调用

var file = new VideoFile(filepath);
file.VideoDuration 
Run Code Online (Sandbox Code Playgroud)

是否有一个库(操作系统或商业)可以跨平台mono/.net工作,可以提供VideoDuration等信息.我目前唯一的做法是包装ffmpeg.exe并读取控制台输出.

.net c# mono ffmpeg

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

.NET中的UTF-8智能UTF-7

如果我有一串UTF-8字符,并且需要以UTF-7的形式输出到旧系统,我有两个与此有关的问题.

  1. 如何将具有UTF-8字符的字符串s转换为没有这些字符的相同字符串?

  2. 是否有任何简单的转换扩展字符,如'?' 他们最接近的非延伸等价'O'?

.net utf-8 utf-7

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

调整图像gdi + graphics .net的大小

我有这种方法缩小我正在处理的网站的图像:

static byte[] createSmallerImage(
   BlogPhoto blogPhoto, 
   int newMaxWidth, 
   int newMaxHeight)
{
  Image img;
  using (MemoryStream originalImage = 
           new MemoryStream(blogPhoto.BlogPhotoImage))
  {
    img = Image.FromStream(originalImage);
  }

  int newWidth;
  int newHeight;
  byte[] arr;

  if (img.Width > img.Height)
  {
    if (img.Width <= newMaxWidth)
    {

      using (MemoryStream thumbStr = new MemoryStream())
      {
        img.Save(thumbStr, ImageFormat.Jpeg);
        img.Dispose();
        arr = thumbStr.ToArray();
      }
      return arr;
    }

    newWidth = newMaxWidth;
    newHeight = 
       (int)(((float)newWidth / (float)img.Width) * (float)img.Height);
  }
  else
  {
    if (img.Height <= newMaxHeight)
    {

      using (MemoryStream thumbStr = new …
Run Code Online (Sandbox Code Playgroud)

.net c# gdi+

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

Unity MVC注入当前用户

我使用的是基本的Unity MVC Nuget Bootstrapper.我想将当前登录的用户注入我定义的服务中

_container.RegisterType<IDoSomethingService, DoSomethingService>();
Run Code Online (Sandbox Code Playgroud)

这样DoSomethingService获取ICurrentUser对象或某种形式的解析器.

我试图避免不得不拨打电话

DoSomethingService.DoSomething(currentUserUsingService,...);
Run Code Online (Sandbox Code Playgroud)

或者在所有MVC控制器的构造函数中也避免设置:

DoSomethingService.CurrentUSer = User.Identity.Name;
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-membership unity-container asp.net-mvc-3

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