日期:2014-05-17  浏览次数:20405 次

ashx中session问题
我使用了uploadify插件上传文件
多文件上传,有进度条显示
上传操作写在ashx中
但是我有些值得传递回去,我就放入session
  context.Session["xxx"]="aaa";
上传成功跳转到a.aspx中
string str=Session["xxx"];
我在IE中和FF中都可以上传并传递session
在Google浏览器中就出现了错误


URI formats are not supported.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: URI formats are not supported.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

------解决方案--------------------
session 不存在有传递这种说法,可以认为是个公共变量

你这个问题,不知道是哪行代码报错,但上面的描述来看,是你的提交地址有问题,跟session无关




------解决方案--------------------
if(Session["xxx"]!=null)
{}
------解决方案--------------------
估计应该是你的google浏览器禁用cookie了吧,而session设置又刚好设置成依赖cookie的,所以就传不过去了
------解决方案--------------------
session的传递跟客户端浏览器关系不大(除非同时用到了cookie),这个是服务器端的动作.
但是不保证chrome的open或者跳转页面会刷新页面(相当于新建连接,重建会话)造成session丢失.
(推测而已,没有怎么弄过chrome)

因此.可能出错的地方
1.uploadify插件在chrome下表现异常,造成页面跳转不成功
2.你代码的错误,可能url写法不正确,或者跳转动作完成前出错.
------解决方案--------------------
调浏览器的安全级别。是浏览器的安全级别限制了 seesion 的读取。建议你别搞啥session 来存。
------解决方案--------------------
使用其他上传组件看看
或ajax无刷新上传文件,使用iframe模仿 
检查跳转方法
------解决方案--------------------
在一般处理程序中用session

引用
using System.Web.SessionState;

public class Handler : IHttpHandler, IRequiresSessionState
------解决方案--------------------
干嘛用Session传?处于安全考虑!??

uploadify传值网上应该有啊!

我自己的方案(GET):
$('#uploadify').uploadifySettings('script','upload.ashx?opertype=pricedocument&id=' + id);
//点击上传前,动态设置参数;

------解决方案--------------------
学习一下!