473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Server.MapPath("~")

txtUpload1.PostedFile.SaveAs(Server.MapPath("~") + "\\" + file1.Name);

this code loads the file in the root directory of my application, by using
the tilde. How do I accomplish getting the file to loaded above root. My
application is within another applilcation (subdomain). I guess I am looking
the .net equivalent to .. in unix.

Thanks.
Nov 17 '05 #1
4 9395
I could not understand what u mean but i think

Request.PhysicalApplicationPath
Request.PhysicalPath
Request.CurrentExecutionFilePath
Request.ApplicationPath

can help u

--

Thanks,
Yunus Emre ALPÖZEN
BSc, MCAD.NET

"ramonred" <ra******@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
txtUpload1.PostedFile.SaveAs(Server.MapPath("~") + "\\" + file1.Name);

this code loads the file in the root directory of my application, by using
the tilde. How do I accomplish getting the file to loaded above root. My
application is within another applilcation (subdomain). I guess I am
looking
the .net equivalent to .. in unix.

Thanks.

Nov 17 '05 #2
Hello

System.IO.Path.GetDirectoryName returns the parent directory of a file or
directory.

Best regards,
Sherif

"ramonred" <ra******@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
txtUpload1.PostedFile.SaveAs(Server.MapPath("~") + "\\" + file1.Name);

this code loads the file in the root directory of my application, by using
the tilde. How do I accomplish getting the file to loaded above root. My
application is within another applilcation (subdomain). I guess I am
looking
the .net equivalent to .. in unix.

Thanks.

Nov 17 '05 #3
The .Net equivalent to ".." is ".."

The problem is, .Net will not let you access a directory outside of your
application.

Imagine that you website is on a shared server at a web hosting
provider. Allowing you to do what you are trying here, could let you hack
other people's website.

--
--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com

"ramonred" <ra******@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
txtUpload1.PostedFile.SaveAs(Server.MapPath("~") + "\\" + file1.Name);

this code loads the file in the root directory of my application, by using
the tilde. How do I accomplish getting the file to loaded above root. My
application is within another applilcation (subdomain). I guess I am looking the .net equivalent to .. in unix.

Thanks.

Nov 17 '05 #4
James is Right,

..Net will now allow u to access outside from your VD. and i think you are
trying to go one directory up then your root Directory.

Thanks
Ritesh

"ramonred" wrote:
txtUpload1.PostedFile.SaveAs(Server.MapPath("~") + "\\" + file1.Name);

this code loads the file in the root directory of my application, by using
the tilde. How do I accomplish getting the file to loaded above root. My
application is within another applilcation (subdomain). I guess I am looking
the .net equivalent to .. in unix.

Thanks.

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
3
by: Mikkky | last post by:
The sample code below returns and error " The type or namspace name 'Server' could not be found". Please help. using System;using System.IO; using System.Xml;using System.Diagnostics; using...
1
by: Jim Heavey | last post by:
Hello, I am trying out how to programatically figure out where my datafile is. I thought I could use Server.MapPath to provide me the name of where my webpage is located, as I have used that in...
2
by: Tee | last post by:
Hi, I am currently using Server.MapPath in my aspx files, but because of I am using it more than once, I would like to move these code away from aspx and make it as a public function inside...
0
by: Jim Moon | last post by:
Hello. We have SQL Server Stored Procedures that use the "CURRENT_USER" variable. We have SQL Server database fields that call "user_name()" as a default. That has been fine in the use and...
2
by: Jim Moon | last post by:
Hello. We have SQL Server Stored Procedures that use the "CURRENT_USER" variable. We have SQL Server database fields that call "user_name()" as a default. That has been fine in the use and...
10
by: Kenneth P | last post by:
Hi all, I have an Access database and try to create a connection to it using the Server.MapPath method. I have the app lib in c:\inetprub\wwwroot\apps\myApp and the database in...
1
by: ae | last post by:
is the prope way to read xml files, as long as they are on my server, but how do i access them from other sites, such as http://www.site.com/xmltoread.xm
5
by: MichiMichi | last post by:
When using Server.MapPath on IIS 5 on my localhost everything works well. All of the following commands are executed without any error Response.Write(Server.MapPath("/app_test") & "<br>")...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.