我重写该类以执行自定义授权
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class AuthorizeAttribute : System.Web.Mvc.AuthorizeAttribute
{
protected override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext)
{
if (filterContext.HttpContext.Request.IsAuthenticated)
{
filterContext.Result = new System.Web.Mvc.HttpStatusCodeResult(403);
}
else
{
base.HandleUnauthorizedRequest(filterContext);
}
}
}
Run Code Online (Sandbox Code Playgroud)
现在在web.config中我配置了403错误页面
<customErrors defaultRedirect="/Shared/Error" mode="On">
<error statusCode="403" redirect="/Shared/UnAuthorize" />
</customErrors>
Run Code Online (Sandbox Code Playgroud)
但是浏览器仍然显示403的默认错误页面,我在这里缺少任何想法
我想从C#创建一个excel 2010文件,那么它的XlFileFormat Enumeration是什么.
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.xlfileformat.aspx
我在Monotouch框架中工作,我必须显示图像,我所拥有的是byte [].
所以我用过
Public static Public static UIImage GetImagefromByteArray (byte[] byteArrayIn){
using (MemoryStream memStream = new MemoryStream ())
{
byte[] streamBytes = new byte [byteArrayIn.Length];
memStream.Read( streamBytes, 0, byteArrayIn.Length);
NSData data = NSData.FromArray( streamBytes );
return UIImage.LoadFromData( data );
}
}
Run Code Online (Sandbox Code Playgroud)
但它总是返回null,我搜索它,所以才知道它是monotouch中的一个bug. 错误报告链接,所以我可以用什么功能来显示图像.
我正在使用Eclipse,Helios Service Release 2,Build id:20110218-0911.
我创建了一个新的动态网站,我在其中添加了google app engine sdks.现在我在问题窗口中显示以下消息,
Classpath entry com.google.appengine.eclipse.core.GAE_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.
Run Code Online (Sandbox Code Playgroud)
由于这个原因,sdk中的jar文件没有进入WEB-INF的lib文件夹,
任何想法如何解决?
HI,
我想向用户发送一封非常精美的电子邮件.这样的外观和感觉与网页相同.
一种非常糟糕的方法,使用StringBuilder并在其中附加文本.
但我正在寻找最佳实践解决方案.页面很容易重新设计.
我需要ASP.NET和MVC的解决方案.
任何的想法.
谢谢,
我如何查询CRM Dynamics以获得前50条记录(如sqlserver中的top)。
谢谢,
我必须在我的自定义实体上运行ondemand工作流,
假设我有100万条记录,那么我怎样才能在这些记录上运行这个工作流程.
因为,据我所知,我们只能选择记录,并从功能区点击运行工作流程并指定它.通过这种方式,在单次尝试中,我只能选择一个页面记录,从而限制访问
任何的想法?
customization workflow-foundation ondemand dynamics-crm-2011
我注意到,如果一些MessageBox出现,你甚至只需要在其上的OK按钮,用户点击从Windows Phone 7的后退按钮时,您将收到Cancel在MessageBoxResult.
有人经历过吗?
c# ×2
asp.net ×1
back-button ×1
c#-4.0 ×1
eclipse ×1
email ×1
excel-2010 ×1
image ×1
iphone ×1
jar ×1
java ×1
messagebox ×1
ondemand ×1
sendmail ×1
stream ×1
uiimage ×1
unauthorized ×1
xamarin.ios ×1