Click here to Skip to main content
12,892,015 members (57,597 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
When iam executing iam getting the problem. the network path was not found
can any help was the problem is..thanks in advance
public void ProcessRequest(HttpContext context)
            string imagePath = context.Request.QueryString["image"];
            // split the string on periods and read the last element, this is to ensure we have
            // the right ContentType if the file is named something like "image1.jpg.png"
            string[] imageArray = imagePath.Split('.');
            if (imageArray.Length <= 1)
                throw new HttpException(404, "Invalid photo name.");
                FileStream file = new FileStream(imagePath,FileMode.Open);
                byte[] buffer = new byte[(int)file.Length];
                context.Response.ContentType = "application/octet-stream";
                //context.Response.ContentType = "image/" + imageArray[imageArray.Length - 1];
        public bool IsReusable
            get { return true; }
Posted 5-Oct-12 4:22am
Updated 5-Oct-12 5:00am
priyanka Dhoble 5-Oct-12 10:36am
Where is the image file stored on client or server? And what is the value of imagePath?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is no problem with the code.

The problem is in tour image file name along with the path.

So, you check what the value is return from the querystring["image"]
and check whether you ca access it in file explorer.

I am sure, the path you passed in querystring is invalid. So, resolving this will make your program run with no issues.


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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100