473,749 Members | 2,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Application Path Physical location

I have a problem in getting asp.net application physical path in global.ascx
static function

in my global.ascx i have a static function :
first i tried to get the physical path by refelection using

string rootPath =
Path.GetDirecto ryName(System.R efelection.Assm ebly.GetExecuti ngAssembly().Lo cation);
but the problem it returned a path in temprary folder in
/winnt/framework/ver/temporay asp.net files ..i do not know why?

then i tried Server.MapPath but exception occured with following message
System.Web.Http Exception: Server operation is not available in this context.
what should I do to get aspnet application physical path?

Nov 19 '05 #1
1 2737
Hello Raed,

The temporary folder is not that strange at all. Every aspx and ascx file
will be compiled to source-code. The compiled code will be in the temporary
directory.

I'm not sure what you should do to get the aspnet application physical path.

Regards,

Mark Monster
I have a problem in getting asp.net application physical path in
global.ascx static function

in my global.ascx i have a static function :
first i tried to get the physical path by refelection using
string rootPath =
Path.GetDirecto ryName(System.R efelection.Assm ebly.GetExecuti ngAssembly
().Location);
but the problem it returned a path in temprary folder in
/winnt/framework/ver/temporay asp.net files ..i do not know why?
then i tried Server.MapPath but exception occured with following
message System.Web.Http Exception: Server operation is not available in
this context.

what should I do to get aspnet application physical path?

Nov 19 '05 #2

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

Similar topics

0
1360
by: Robert Brewer | last post by:
I've got a webapp which is behaving oddly. I want to include an image on the webpage, but only if the physical file exists; if it doesn't, I don't want an img element to generate an ugly blank box. I know the physical location of the image(s) in question, and figured I'd use os.path.exists to see if each file exists. A quick test in the interpreter yields: >>> os.path.exists(u'S:/Scans/Projects/2004/TJ/04TJ0267.jpg') True
1
2938
by: orit | last post by:
I have the following xml file: <?xml version="1.0" encoding="utf-8" ?> <course id="2555" title="Developing Microsoft .NET Applications for Windows (Visual C# .NET)" length="5 days" source="http://www.microsoft.com/learning/syllabi/en-us/2555Afinal.mspx"> <module id="1" title="Introducing Windows Forms" location="D:\Disk-C\Documents and Settings\orit_itzhar.ATRICA\My Documents\XML\csharp"> <lesson id="1.1"> <subject>Creating a...
11
2024
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the the image but in design time mode all variables concerning Server or Context ar not set ! ...so I can't use MapPath function to obtain the physical parth of the picture ... So my second question is how to retrieve the physical root path of the...
1
2082
by: Michał Januszczyk | last post by:
How can I retrieve web application name (or virtual dir name)? (Actually I need physical root directory of web application) I want to open some files in web application root relative directory. Previously I used to open the files when client connected and thus could use the following code to retreive physical file location: string webAppRootDir = Server.MapPath(Request.ApplicationPath);
2
1125
by: Glen | last post by:
I have a web service project that was fine untill I created a new application pool and moved my service to the new pool. Now I can not even open the project in VS. Error message says "file path c:\Inetpub\wwwroot\myproject does not correspond to the url http://localhost/myproject. The two need to map to the same server location. HTTP error 503 service not available." Can somebody please explain what the problem is? Thanks
8
8511
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there a way to get it from a static method in an aspx page, or in the class (static) constructor for an aspx page? Thanks, Bryan
4
4070
by: Dots | last post by:
I have a class library with a method called getpath(). I want to be able to get the full path of a folder and write some files to the (my_files_dir) folder. A console application will use this class library. How can I do this so I wont have to hardcode this path in my getpath() method. Here is the path below. "C:\Inetpub\wwwroot\Web_mycontrol\my_Files_dir\" -- Dotty
1
2986
by: DBC User | last post by:
Hi, I have a program sitting in the network, when I double click the program, first thing I want to do is find the application execution path. I am using the following code Assembly execAssembly = System.Reflection.Assembly.GetExecutingAssembly(); string path = Path.GetPathRoot(execAssembly.Location);
5
7267
by: Ned White | last post by:
I have set up a virtual directory on ISS 6.0 to store the all .jpg and .swf files which i use in my project It is alias name is "OutSrc" Is it possible to acquire a list of files which exist in that virtual directory ? For my default project directory, i can get list of the specific files like that; *******************
0
8997
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.