473,387 Members | 1,504 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.

Can't load a file from a dll under ASPX pages

Hi all,

I currently have a problem that looks too strange for me, can someone
help me?

I'm running an ASPX page that calls a C# component (DLL), and this DLL
works with an XML file.
I've placed the XML file and the C# component in a directory (i can't do
it different, and the installation path can be changed at each
installation)), and the component loads the XML by getting the
"location" property on the assembly object:

Assembly ca = typeof(myObjType).Assembly;
string TheRightPath=ca.Location;

Then my ASPX page uses the component to call some of its methods, and i
get the following error in my browser (i traduced the messages, i get
them in french):

Server in error in application '/MyWebApplication'. --------------------
Impossible to find file
"c:\winnt\microsoft.net\framework\v1.1.4322\tempor ary asp.net
files\MyWebApplication\c4e535bc\84b07167\assembly\ dl2\5801a542\022a2a6f_
f79fc401\MyXmlFile.xml".

I think IIS creates an "execution folder", where the loading of the XML
doesn't work anymore, because the executed DLL is not in the same folder
as the xml...

Thanks for your help...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
6 1576
You should not use the location. You need to use the PhysicalPath, or
ApplicationPath or some such thing that exists server side on to get the
path ( Or you can use Server.MapPath(null) to get the current application
directory).

The location of the assembly will be some cache directory (to support shadow
copy implementation) as you found out.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"Plon Plon" <pl******@netcourrier.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
Hi all,

I currently have a problem that looks too strange for me, can someone
help me?

I'm running an ASPX page that calls a C# component (DLL), and this DLL
works with an XML file.
I've placed the XML file and the C# component in a directory (i can't do
it different, and the installation path can be changed at each
installation)), and the component loads the XML by getting the
"location" property on the assembly object:

Assembly ca = typeof(myObjType).Assembly;
string TheRightPath=ca.Location;

Then my ASPX page uses the component to call some of its methods, and i
get the following error in my browser (i traduced the messages, i get
them in french):

Server in error in application '/MyWebApplication'. --------------------
Impossible to find file
"c:\winnt\microsoft.net\framework\v1.1.4322\tempor ary asp.net
files\MyWebApplication\c4e535bc\84b07167\assembly\ dl2\5801a542\022a2a6f_
f79fc401\MyXmlFile.xml".

I think IIS creates an "execution folder", where the loading of the XML
doesn't work anymore, because the executed DLL is not in the same folder
as the xml...

Thanks for your help...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
string TheRightPath = Server.Mappath(ca.Location);

"Plon Plon" <pl******@netcourrier.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
Hi all,

I currently have a problem that looks too strange for me, can someone
help me?

I'm running an ASPX page that calls a C# component (DLL), and this DLL
works with an XML file.
I've placed the XML file and the C# component in a directory (i can't do
it different, and the installation path can be changed at each
installation)), and the component loads the XML by getting the
"location" property on the assembly object:

Assembly ca = typeof(myObjType).Assembly;
string TheRightPath=ca.Location;

Then my ASPX page uses the component to call some of its methods, and i
get the following error in my browser (i traduced the messages, i get
them in french):

Server in error in application '/MyWebApplication'. --------------------
Impossible to find file
"c:\winnt\microsoft.net\framework\v1.1.4322\tempor ary asp.net
files\MyWebApplication\c4e535bc\84b07167\assembly\ dl2\5801a542\022a2a6f_
f79fc401\MyXmlFile.xml".

I think IIS creates an "execution folder", where the loading of the XML
doesn't work anymore, because the executed DLL is not in the same folder
as the xml...

Thanks for your help...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3
I think This would be wrong because the location is already the physical
path but to the cache folder maintained by ASP.NET.
--
Girish Bharadwaj
http://msmvps.com/gbvb
"C.G. Oh" <co*@alphapointe.org> wrote in message
news:eR**************@TK2MSFTNGP10.phx.gbl...
string TheRightPath = Server.Mappath(ca.Location);

"Plon Plon" <pl******@netcourrier.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
Hi all,

I currently have a problem that looks too strange for me, can someone
help me?

I'm running an ASPX page that calls a C# component (DLL), and this DLL
works with an XML file.
I've placed the XML file and the C# component in a directory (i can't do
it different, and the installation path can be changed at each
installation)), and the component loads the XML by getting the
"location" property on the assembly object:

Assembly ca = typeof(myObjType).Assembly;
string TheRightPath=ca.Location;

Then my ASPX page uses the component to call some of its methods, and i
get the following error in my browser (i traduced the messages, i get
them in french):

Server in error in application '/MyWebApplication'. --------------------
Impossible to find file
"c:\winnt\microsoft.net\framework\v1.1.4322\tempor ary asp.net
files\MyWebApplication\c4e535bc\84b07167\assembly\ dl2\5801a542\022a2a6f_
f79fc401\MyXmlFile.xml".

I think IIS creates an "execution folder", where the loading of the XML
doesn't work anymore, because the executed DLL is not in the same folder
as the xml...

Thanks for your help...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #4
Yes, that's what i found. Getting the location retrieves me the cache
path (the path "c:\winnt\microsoft.net\framework\v1.1.4322\tempor ary
asp.net
files\MyWebApplication\c4e535bc\84b07167\assembly\ dl2")

What i want to retrieve is the path where the "original" copy of the dll
is... Because my XML file is in this folder, not in the cache folder...

As Girish said in his first post, i'll try the PhysicalPath, or
ApplicationPath or Server.MapPath(null).

I'll post my results. Thanks for your help.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #5
Ok, it seems that the applicationPath and the PhysicalPath are some
"request" properties, so it works fine to retrieve them in my ASPX page.

But I can't use these ones because the loading of the XML file is done
in the DLL. It's the DLL that must calculate the XML path, because this
DLL can both be used by the ASP.NET site and a c/s application (and
strangely i don't have problems when i use the DLL with my c/s
application)...

Has someone another idea?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #6
I believe you should be able to reference
HttpContext.Current.Request.PhysicalPath from your assembly as well. Of
course,you need to use this conditionally to see if HttpContext.Current is
null or not.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"Plon Plon" <pl******@netcourrier.com> wrote in message
news:O1**************@TK2MSFTNGP11.phx.gbl...
Ok, it seems that the applicationPath and the PhysicalPath are some
"request" properties, so it works fine to retrieve them in my ASPX page.

But I can't use these ones because the loading of the XML file is done
in the DLL. It's the DLL that must calculate the XML path, because this
DLL can both be used by the ASP.NET site and a c/s application (and
strangely i don't have problems when i use the DLL with my c/s
application)...

Has someone another idea?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #7

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

Similar topics

1
by: VJ | last post by:
I have a ASP.NET page Main.aspx with 4 frames. The center frame loads the login.aspx file. The other three load gif file or html files. The Main.aspx is the start page for my website Now I am...
1
by: Magdelin | last post by:
Hi, I have a BasePage class from which all other ASPX pages of the project is inherited. The BasePage class implements Page_Load event handler. All child pages have its AutoEventWireUp property...
2
by: Alex Nitulescu | last post by:
Hi. I have a web.config which says that all files with the "axd" extension should by a special handler. The handler writes some stats to the "axd" page. Public Class WhosOnHandler Implements...
7
by: Alan Silver | last post by:
Hello, I would like to create a new web site with VWD, but would like to run it under IIS, not the development server. One reason for this is that I want the web site to be at the domain root,...
24
by: Randall Arnold | last post by:
I know how to use MSHTML to grab the innerhtml from an html web page, but what if I want to look at elements of a rendered aspx page? Is there any way to do this using the MSHTML DOM object? ...
5
by: Ravi Ambros Wallau | last post by:
Dear friends: This is my third question on this news in three days... Sorry for this spam behavior :-) I've a lot of problems on "first page load" after some change on web.config or even in the...
2
by: Ranginald | last post by:
Hi, I have two pages. Default.aspx ....Codefile="default.aspx.cs" Inherits="Web" %> and Sculpture.aspx
1
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class...
0
by: Alka2378 | last post by:
I developed an application with some pages.. I m trying to use one page ino another page.. first page :- TreeView.aspx, class name TreeView in second page Management.aspx i had writtene <%@...
2
by: ngchaitra | last post by:
The project has been developed using .net2002. now i want to add more pages accoring to the users requirement. they work fine in the local system but when i put them into the server, it gives the...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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.