如何在调用webmethod时解决自动身份验证失败错误? [英] How to solved Authantication failed error when call webmethod?
本文介绍了如何在调用webmethod时解决自动身份验证失败错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我调用webmethod和Redirect Page然后在浏览器控制台中获取身份验证失败错误。
这里是代码:
When i am call webmethod and Redirect Page then getting Authentication failed error in browser console.
here is that code:
[WebMethod]
public static void fileDownloadUsingWebMethod(object dataPath)
{
string saveBasePath = "";
string folderName = "";
saveBasePath = HttpContext.Current.Server.MapPath("~/developeruploads/MindShare/");
folderName = "Mindshare";
//[original name,renamed name]
string[] strFileName = new string[2];
strFileName = Convert.ToString(dataPath).Split(';');
string strFilePath = Path.Combine(saveBasePath, strFileName[1]);
FileInfo fi = new FileInfo(strFilePath);
if (fi.Exists)
{
HttpContext.Current.Session["DwFolderName"] = folderName;
HttpContext.Current.Response.Redirect("~/brightableweb/downloading.aspx?file=" + fi.Name.Replace("&", "_") + "&fileName=" + strFileName[0],false);
}
}
推荐答案
确保您的IIS用户具有完全访问权限如果是这样,请检查您正在访问的文件夹是否只读
Make sure your IIS user has full access and check whether the folder which you are accessing is readonly if so change it
这篇关于如何在调用webmethod时解决自动身份验证失败错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文