To solve the problem that the uploadify upload control does not work in a non-IE browser, perform the following two steps:
1. Implement the application_beginrequest function in the global. asax file:
Void application_beginrequest (Object sender, eventargs E)
{
Try
{
String session_param_name = "aspsessid ";
String session_cookie_name = "ASP. net_sessionid ";
If (httpcontext. Current. Request. Form [session_param_name]! = NULL)
{
Updatecookie (session_cookie_name, httpcontext. Current. Request. Form [session_param_name]);
}
Else if (httpcontext. Current. Request. querystring [session_param_name]! = NULL)
{
Updatecookie (session_cookie_name, httpcontext. Current. Request. querystring [session_param_name]);
}
}
Catch {}
Try
{
String auth_param_name = "authid ";
String auth_cookie_name = formsauthentication. formscookiename;
If (httpcontext. Current. Request. Form [auth_param_name]! = NULL)
{
Updatecookie (auth_cookie_name, httpcontext. Current. Request. Form [auth_param_name]);
}
Else if (httpcontext. Current. Request. querystring [auth_param_name]! = NULL)
{
Updatecookie (auth_cookie_name, httpcontext. Current. Request. querystring [auth_param_name]);
}
}
Catch {}
}
Private void updatecookie (string cookie_name, string cookie_value)
{
Httpcookie cookie = httpcontext. Current. Request. Cookies. Get (cookie_name );
If (null = cookie)
{
Cookie = new httpcookie (cookie_name );
}
Cookie. value = cookie_value;
Httpcontext. Current. Request. Cookies. Set (cookie );}
}
2.
Front-end JS modification, pay attention to the red code:
// Upload
VaR auth = "@ (request. Cookies [formsauthentication. formscookiename] = NULL? String. Empty: request. Cookies [formsauthentication. formscookiename]. Value )";
VaR aspsessid = "@ (session. sessionid )";
$ ('# Fileinput1'). uploadify ({
'Upload': '/content/uploadify.swf? Var = '+ new date (). gettime (),
'Script': '/money/importmoneyindue ',
'Folder': '/uploadfiles ',
'Canonicalimg': '/content/cancel.png ',
'Scriptdata': {aspsessid: aspsessid, authid: AUTH },
'Text': '*. xls; *. csv ',
'Filedesc': '*. xls; *. csv ',
'Sizelimmit ': 1024*1024*4, // 4 m
'Multi ': false,
'Oncomplete': Fun
});
In this way, you can.