473,387 Members | 1,549 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,387 software developers and data experts.

File Path in application code

Hi all

I would like to reference a file in a class in the 'App_Code' folder and I
wanted to use the server.MapPath property

How can I do that?

Samuel
Oct 28 '06 #1
8 1667
How can you have a "file in a class"? confused.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Samuel Shulman" wrote:
Hi all

I would like to reference a file in a class in the 'App_Code' folder and I
wanted to use the server.MapPath property

How can I do that?

Samuel
Oct 28 '06 #2
A File Path

I want to stae the path of a datbase (.mdb) file but instead of stating the
absolute path I want to state the relative path so I wanted to use the
server.Mappath property

Thank you,
Samuel

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:8F**********************************@microsof t.com...
How can you have a "file in a class"? confused.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Samuel Shulman" wrote:
>Hi all

I would like to reference a file in a class in the 'App_Code' folder and
I
wanted to use the server.MapPath property

How can I do that?

Samuel

Oct 28 '06 #3
Samuel,

It is not clear at all what you are asking for. Can you give an example in
pseudo code?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>A File Path

I want to stae the path of a datbase (.mdb) file but instead of stating
the absolute path I want to state the relative path so I wanted to use the
server.Mappath property

Thank you,
Samuel

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:8F**********************************@microsof t.com...
>How can you have a "file in a class"? confused.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Samuel Shulman" wrote:
>>Hi all

I would like to reference a file in a class in the 'App_Code' folder and
I
wanted to use the server.MapPath property

How can I do that?

Samuel


Oct 29 '06 #4
I simply want to create a connection string using the server.mappath to a
database file that resides in a sub folder in the website

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OD****************@TK2MSFTNGP02.phx.gbl...
Samuel,

It is not clear at all what you are asking for. Can you give an example in
pseudo code?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>>A File Path

I want to stae the path of a datbase (.mdb) file but instead of stating
the absolute path I want to state the relative path so I wanted to use
the server.Mappath property

Thank you,
Samuel

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in
message news:8F**********************************@microsof t.com...
>>How can you have a "file in a class"? confused.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Samuel Shulman" wrote:

Hi all

I would like to reference a file in a class in the 'App_Code' folder
and I
wanted to use the server.MapPath property

How can I do that?

Samuel



Oct 29 '06 #5
So what is your problem with MapPath method?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:uq****************@TK2MSFTNGP03.phx.gbl...
>I simply want to create a connection string using the server.mappath to a
database file that resides in a sub folder in the website

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OD****************@TK2MSFTNGP02.phx.gbl...
>Samuel,

It is not clear at all what you are asking for. Can you give an example
in pseudo code?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl. ..
>>>A File Path

I want to stae the path of a datbase (.mdb) file but instead of stating
the absolute path I want to state the relative path so I wanted to use
the server.Mappath property

Thank you,
Samuel

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in
message news:8F**********************************@microsof t.com...
How can you have a "file in a class"? confused.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Samuel Shulman" wrote:

Hi all
>
I would like to reference a file in a class in the 'App_Code' folder
and I
wanted to use the server.MapPath property
>
How can I do that?
>
Samuel
>
>
>




Oct 29 '06 #6
It simply doesn't work (the class is under the 'App_Code' folder)
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:%2******************@TK2MSFTNGP02.phx.gbl...
So what is your problem with MapPath method?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:uq****************@TK2MSFTNGP03.phx.gbl...
>>I simply want to create a connection string using the server.mappath to a
database file that resides in a sub folder in the website

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OD****************@TK2MSFTNGP02.phx.gbl...
>>Samuel,

It is not clear at all what you are asking for. Can you give an example
in pseudo code?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl.. .
A File Path

I want to stae the path of a datbase (.mdb) file but instead of stating
the absolute path I want to state the relative path so I wanted to use
the server.Mappath property

Thank you,
Samuel

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in
message news:8F**********************************@microsof t.com...
How can you have a "file in a class"? confused.
Peter
>
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"Samuel Shulman" wrote:
>
>Hi all
>>
>I would like to reference a file in a class in the 'App_Code' folder
>and I
>wanted to use the server.MapPath property
>>
>How can I do that?
>>
>Samuel
>>
>>
>>




Oct 29 '06 #7
It does. Likely something is not 100% right on your side. You can make this
thread more productive if you tell what you pass to the method, what you
expect and what you get.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:uM****************@TK2MSFTNGP04.phx.gbl...
It simply doesn't work (the class is under the 'App_Code' folder)
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:%2******************@TK2MSFTNGP02.phx.gbl...
>So what is your problem with MapPath method?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:uq****************@TK2MSFTNGP03.phx.gbl...
>>>I simply want to create a connection string using the server.mappath to a
database file that resides in a sub folder in the website

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OD****************@TK2MSFTNGP02.phx.gbl...
Samuel,

It is not clear at all what you are asking for. Can you give an example
in pseudo code?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl. ..
>A File Path
>
I want to stae the path of a datbase (.mdb) file but instead of
stating the absolute path I want to state the relative path so I
wanted to use the server.Mappath property
>
Thank you,
Samuel
>
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in
message news:8F**********************************@microsof t.com...
>How can you have a "file in a class"? confused.
>Peter
>>
>--
>Co-founder, Eggheadcafe.com developer portal:
>http://www.eggheadcafe.com
>UnBlog:
>http://petesbloggerama.blogspot.com
>>
>>
>>
>>
>"Samuel Shulman" wrote:
>>
>>Hi all
>>>
>>I would like to reference a file in a class in the 'App_Code' folder
>>and I
>>wanted to use the server.MapPath property
>>>
>>How can I do that?
>>>
>>Samuel
>>>
>>>
>>>
>
>




Oct 29 '06 #8
I think what you are looking for is:

HttpContext.Current.Server.MapPath

*** Sent via Developersdex http://www.developersdex.com ***
Nov 6 '06 #9

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

Similar topics

0
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to...
0
by: brian.fairchild | last post by:
I have a downloader page in my asp.net application that looks at a session variable to get the path to the file, checks it then downloads it using the Response object. When the "File Download"...
0
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to...
5
by: Eugene Anthony | last post by:
ds1.Tables.Rows.ItemArray.GetValue(0).ToString() contains the string path: images/5/Video1/qbert.flv if (File.Exists(ds1.Tables.Rows.ItemArray.GetValue(0).ToString())) { //code to execute } ...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.