I'm working with DotNetNuke's scheduler to schedule tasks and I'm looking to get the physical file path of a email template that I created. The problem is that HttpContext is NULL because the scheduled task is on a different thread and there is not http request. How would you go about getting the file's physical path?
...
In Classic ASP, Server.MapPath() doesn't always work properly in the Application_OnStart event within global.asa. I have an ASP page at "\testfolder\test.asp" within a virtual root, I have an XSLT file at "\xsl\transform.xsl". My virtual root is located in "c:\inetpub\wwwroot\testapp\".
I use MapPath within the ASP page to get the full ...
How can I get the virtual path for a full path in ASP classic. Note that the full path may be under a virtual directory and therefore the simplistic
virtPath = Replace(fullPath, Server.MapPath("/"), "")
method will not work.
Edit: To clarify, an example follows
Full Windows File Path (known):
\\MyServer\MyShare\Web\Site\Logs\Test...
I need to use Server.MapPath() to combine some files path that I store in the web.config.
However, since Server.MapPath() relies on the current HttpContext (I think), I am unable to do this. When trying to use the method, even though its "available", I get the following exception:
"Server operation is not available in this context."
...
Hi,
I have the following scenario with ASP.NET 2.0. I have declared an atlas:timer as follows in my .aspx page:
<atlas:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="3000"
Enabled="false"> </atlas:Timer>
I also have a button on a form which when clicked launches a new System.Threading.Thr...
How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite
...
First of all, I am aware that this question is dangerously close to:
http://stackoverflow.com/questions/1231860/how-to-mappath-in-a-unit-test-in-c
I'm hoping however, that it has a different solution. My issue follows:
In my code I have an object that needs to be validated. I am creating unit tests for each validation method to make su...
Hi,
I want to use Server.MapPath() method im order to map a virtual directory
I created to its physical path.
The thing is that the .net environment doesn't recognize Server.MapPath().
Google told me I'm supposed to use HttpContext.Current.Server using System.Web,
but HttpContext isn't recognized in spite of me using System.Web. (And ...
I am working with two different web sites in asp.net. In the first project i upload some images to a specific folder under the project root and save just the filename in the database, now i am trying to display this images at some page of the second project I know the filename from the database and the image folder as absolute pat but I ...
Hai guys,
I have two folders called CSVLoad and Forms... I have an aspx page inside forms folder which has a fileupload control. I save my uploaded file to my CSVLoad folder i gave the following path
FileUpload1.SaveAs(Server.MapPath("CSVLoad//" + FileUpload1.FileName));
I am receiving file not found exception...
Could not find a p...
I am working on a mailSender Class. I can't use the Server.MapPath method from the System.Web.UI Namespace. What reference should i set to make this work? I have referenced to the System / System.Web / System.Web.UI.
This is the msdn i have checked.
...
Hi,
I have a WCF service method that's running in a worker thread I spin from another method. I need to map a relative service app path ("~/Templates/a.template") to the physical path ("D:\Web\Templates\a.template"), but I can't use HttpContext.Current.Server.MapPath because HttpContext.Current is null in a worker thread. How else can I...
Hi all:
I'm having difficulties getting XslCompiledTransform.Load method to take a server path. I googled around and found that I need to do something like:
xslt.Load(System.Web.HttpContext.Server.MapPath(xslPath), XsltSettings.Default, new XmlUrlResolver());
But it returned an error saying HttpContext is null.
I also tried:
xslt....
I imported system.web into my class lib project.
Trying to find:
system.web.httpserverutility.server.mappath
But I dont' get the method in intellisense?
It is a .net 2.0 build.
...
I'm trying to call an asp.net webservice from the same project it's in:
[MethodImpl(MethodImplOptions.Synchronized)]
public static void OnFileCreated(object source, FileSystemEventArgs e) {
trackdata_analyse rWebAnalyse = new trackdata_analyse();
rWebAnalyse.Analyse(@"pending\" + e.Name, "YOUNIVATE");
}
However i always get ...
Hi,
I am trying to read an XSLT file from disk in my ASP.Net MVC controller. What I am doing is the following:
string filepath = HttpContext.Request.PhysicalApplicationPath;
filepath += "/Content/Xsl/pubmed.xslt";
string xsl = System.IO.File.ReadAllText(filepath);
However, half way down this thread on forums.asp.net there is the foll...
my web application has an xml file here:
/files/xml/test.xml
I need to load a XDocument from within a class library project, how will I reference the xml? I don't want to pass any path parameters to this method.
I want to assume the location is fixed at /files/xml/test.xml.
How can I load a XDocument know this?
I don't seem to hav...
Hi all,
I have had a real nightmare with Server.MapPath(). When I call Server.MapPath("~") in my application that is running in ASP.NET Development Server it returns root directory that ends in a back slash like f:\projects\app1\, but I call it in published version, installed in IIS, it returns root directory without any back slash like...
I'm about to begin to use the asp.net module found at http://nathanaeljones.com/products/asp-net-image-resizer/
The module works like this: localhost/files/image.jpg.axd?width=400 (the module identifies this and resizes the image image.jpg).
The problem is that I'm not just using images that is on my filesystem, I'm also using files th...
Hello, I'm trying to access files in a virtual directory I created in IIS for the first time but am getting weird results.
OS: Windows XP Pro
IIS: 5.1
Development Platform: Visual Studio 2008
Language: C#
Virtual Directory Name: portal
Local Path: C:\digital_communications_report_portal
Default Website Local Path: c:\inetpub\wwwr...