what is the difference between httppathrequest and server.mappath.

i mean r they return different path ?

i uploading file use httppahrequest and it works fine in my pc iis7, but when i run in server it didnt work. but server.mappath work in both

Recommended Answers

All 3 Replies

>what is the difference between httppathrequest and server.mappath.

I think you want to know about Request.MapPath and Server.MapPath.
There is no difference.

>what is the difference between httppathrequest and server.mappath.

I think you want to know about Request.MapPath and Server.MapPath.
There is no difference.

please check below code

savePath = Path.Combine(Request.PhysicalApplicationPath, ImageFolder);
                        saveFile = Path.Combine(savePath, FileUpload1.FileName);
                        FileUpload1.SaveAs(saveFile);

that was only in my vs08 when i run in server that not work.
but below code was worked in both

FileUpload1.SaveAs(Server.MapPath("foldername") + "\\" + FileUpload1.FileName);

for this reason one of my projec was rejected by client, so i want to explain him wha happened

Check this code,

Response.Write("<Br/>" + Request.PhysicalApplicationPath); // x:\test\
Response.Write("<br/>" + Server.MapPath("~"));                  //  x:\test
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.