473,320 Members | 1,872 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.

HttpContext.Current.Server.MapPath

I have an xml configuration file in my project.

when I am working in debug mode of .net IDE it is working fine, but when i tried to launch the project from IE, it is taking different path

ex:
below code works well in debug mode, but unable to launch in IE directly (http://localhost/WebProj/login.aspx)

Pathtype A:
Expand|Select|Wrap|Line Numbers
  1.  HttpContext.Current.Server.MapPath(@"\Configuration\xyz.xml"); 
below code works well in IE and debug mode but having different problem.
Pathtype B:
Expand|Select|Wrap|Line Numbers
  1.  HttpContext.Current.Server.MapPath("") + @"\Configuration\xyz.xml"; 
Problem: I have a folder MainPages under root folder of the project. under this I have AdminPages. These admin pages are not retrieving if I used pathtype B specified above and gives error no page available, but works fine when pathtype A specified above is used which runs in debug mode only but not able launch from IE.

Help me please.
Jun 17 '10 #1
0 1561

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

Similar topics

6
by: Daniel Groh | last post by:
Hi Joe, no it's not static...yes..it's static when u have a webapplication and i have a class library application, try it and tell me, may be could be a problem in my framework lib u know ? but i...
2
by: Jeff S | last post by:
In a VB/ASP.NET project, the following lines work as advertised when placed in a code-behind file (whatever.aspx.vb) - meaning that I get the full physical path to MyDatabase.MDB in the variable...
6
by: Anthony Williams | last post by:
Hi all, Am I right in thinking that if I set Server.ScriptTimeout to, say, 600 that every request for an .ASPX page will wait up to 600 seconds before responding with a "Request Timed Out"...
3
by: MattB | last post by:
If I use server.mappath to get to the root dir of my application from within codebehind, it works fine. I also want to use this from a vb class I have in my application, and I think I have an issue...
1
by: Dave | last post by:
I'm trying call a couple WebRequests asynchronously using the QueueUserWorkItem, but one thing I noticed is that the HttpContext is null within the asynchronous call. I was using...
4
by: Colin | last post by:
In the code behind server.mappath works fine, yet in a class I get 'Server operation is not available in this context'. System.Web.HttpApplication is inherited in the class, why is this so? ...
2
by: Scott | last post by:
Hi there, I am writing a webservice and am wanting to use Server.MapPath to get the path to some files on the server that is hosting the webservice. I am using VB.NET atm, but am learning C#, so...
1
by: Peter Kirk | last post by:
Hi we have some classes which sometimes run in a web application, and sometimes run in standalone applications. These classes have some configuration parameters, of which one is a file-path to...
1
by: xeroxero | last post by:
When a user hits a web page in ASP.NET 2.0, I can use HttpContext.Current.Server.MapPath("~/mydir") to find the real filesystem location of a file. But in an event triggered in my global.asax,...
4
by: amollokhande1 | last post by:
Hi, I am facing an issue while decoding the data using System.Web.HttpContext.Current.Server.UrlDecode If data contains "+" sign, it replaces it with " " space after decoding. Can anybody...
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
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.