Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When i am call webmethod and Redirect Page then getting Authentication failed error in browser console.

here is that code:

C#
[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);

            }

    }
Posted

1 solution

Make sure your IIS user has full access and check whether the folder which you are accessing is readonly if so change it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900