验证在ASP.NET的HttpHandler [英] Authentication in ASP.NET HttpHandler

查看:179
本文介绍了验证在ASP.NET的HttpHandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建与SWFUpload的用于图像上载至服务器的HttpHandler。因此用户需要进行身份验证上传图片上传这是一个管理后台完成的。

I have created a HttpHandler to be used with SWFUpload to upload images to the server. This upload is done in an administration backend so users need to be authenticated to upload images.

起初,我让整个行政区域否认annonymous用户,但由于方式的SWFUpload似乎工作就不会与窗体身份验证正常工作,将返回302状态code。

Initially I made the whole administration area deny annonymous users but because of the way SWFUpload appears to work it wouldn't work correctly with Forms authentication and would return a 302 status code.

我认为这将有可能使我的处理程序公开的位置在Web.config中,并使用context.User.Identity.IsAuthenticated在我的处理程序,以确定用户是否登录。

I had thought it would be possible to make the location of my handler public in Web.config and use context.User.Identity.IsAuthenticated in my handler to determine if the user is logged in.

我的问题:是 context.User.Identity.IsAuthenticated 似乎总是在处理假我,登陆之后没有人有。为什么这可能是什么想法?

My problem: is that context.User.Identity.IsAuthenticated always seems false in the handler after I have logged in. Does anyone have any thoughts on why this might be?

推荐答案

我的问题是具体到一些$ C $下加入Global.asax中修复SWFUpload的饼干错误的非IE浏览器。我已经修改了的Application_BeginRequest事件处理程序的 session_cookie_name 变量的值是我在Web.config中设置了相同的名称。

My problem was specific to some code added to Global.asax to fix SWFUpload cookie bug for non-IE browsers. I had modified the value of the session_cookie_name variable in the Application_BeginRequest event handler to be the same name as I had set in Web.config.

这样做打破了所有浏览器的功能。应该左边的变量值设置为默认ASP.NET_SESSIONID。

Doing this breaks the functionality across all browsers. The variable value should be left set to its default "ASP.NET_SESSIONID".

这篇关于验证在ASP.NET的HttpHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆