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

go one level up of Application directory

parshupooja
159 100+
Hey All,

I have following directory structure on server
C:\data\inetpub\wwwroot\MyApp
C:\data\inetpub\wwwroot\Images

My App is my application and I have MyPage.aspx there. In that MyPage I want to access images from C:\data\inetpub\wwwroot\Images folder.

I tried Server.Mappath() in several ways but it throws error.
string filename = Server.MapPath("~/Images/" + DateTime.Now.Year.ToString() + "/Q" + currentquater.Text.Trim());
Any Idea?
Thanks in advance
Mar 5 '08 #1
5 3166
Plater
7,872 Expert 4TB
Well, in this situation:
C:\data\inetpub\wwwroot\MyApp
C:\data\inetpub\wwwroot\Images

Your could just use "/Images/imagename.jpg" without using any server.mappath or the ~ or anything?
Mar 5 '08 #2
parshupooja
159 100+
Ya i did that, it does not throw error but I can't see images either. Page loads without errors but intstead of images I see small cross sign
string filename = "C:\data\inetpub\wwwroot\Images\" + DateTime.Now.Year.ToString() + "/Q" + currentquater.Text.Trim());

thanks
Well, in this situation:
C:\data\inetpub\wwwroot\MyApp
C:\data\inetpub\wwwroot\Images

Your could just use "/Images/imagename.jpg" without using any server.mappath or the ~ or anything?
Mar 5 '08 #3
Plater
7,872 Expert 4TB
Try this:
src= "\Images\" + DateTime.Now.Year.ToString() + "/Q" + currentquater.Text.Trim());

You should be putting those direct file paths in like that for webpage.


EDIT:
Wait, I thought these were for <img> tags.
You want to use them in the code behind?
Which is it?
Mar 6 '08 #4
parshupooja
159 100+
nope this is not image tag. basically I am creating a file name in this string and than I m checking all images stored in filea and finally loading into datalist control.

thanks
Try this:
src= "\Images\" + DateTime.Now.Year.ToString() + "/Q" + currentquater.Text.Trim());

You should be putting those direct file paths in like that for webpage.


EDIT:
Wait, I thought these were for <img> tags.
You want to use them in the code behind?
Which is it?
Mar 6 '08 #5
Plater
7,872 Expert 4TB
nope this is not image tag. basically I am creating a file name in this string and than I m checking all images stored in filea and finally loading into datalist control.

thanks
Well then, assuming your file-naming pattern is correct, this should work in backend:
string filename = "C:\data\inetpub\wwwroot\Images\" + DateTime.Now.Year.ToString() + "/Q" + currentquater.Text.Trim());

But you cannot use that format in image tags.
Mar 6 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Amil | last post by:
Hum...am I missing something here. Seems like when I create a new web application in visual studio .net, it will put it at http://localhost/newapp/. This is fine..for now. But, I want to write...
4
by: Jeffrey Palermo [MCP] | last post by:
I use web.config files in many directories, and my aspx files can access the AppSettings. If I have a subdirectory Foo with an aspx, and Foo has a local web.config that defines an AppSetting. My...
5
by: rdcpro | last post by:
In reading MSDN docs on creating custom Configuration sections, I found this page: ...
1
by: Alex D. | last post by:
I upgraded one of my applications to beta 2. conversion seemed to work OK, problem is when trying to build I get an error like: it is an error to use a section registered as...
2
by: Support | last post by:
Hello: I am trying to learn about Aactive Directory in VB.NET and NT security, so if you have any good resources/references, please let me know. At a high level ... in VB.NET If I am a...
0
by: Tamir Khason | last post by:
According guidlines of ASP.NET security with medium trust level I should able to use file system IO with my virtual directory, but actual recieve error 500 (not appears with full trust level)...
3
by: Doug | last post by:
Using Visual Studio 2005, SQL Server 2000, and ASP.NET/VB.NET for a Web Application. We have a System DSN using Windows NT authentication defined on the development box to connect to the SQL...
0
by: dgk | last post by:
Is there a FAQ somewhere about how to publish a web app to a (2003) server? I've mapped a drive to a directory under inetpub/wwwroot, and used the Visual Studio "Publish Web Site" menu option to...
1
by: kevingangsun | last post by:
I created an ASP.NET application for our company and it worked great on more than 4 windows 2003 servers. However, when we deployed it to another 2003 server (IIS6), we got the following error...
1
by: Icon Iconoclast | last post by:
Why is this being caused and what is the solution? I am using a book that teaches ASP.NET 2.0 but trying out the example codes on my ASP.NET 3.5 running the development server instead of IIS. What...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.