Server.MapPath Not Accepting UNC URL?

Mar 2, 2011

I'm having a bit of trouble loading an XML file with ASP. This is the location of the XML file (it's a UNC url):

\ilife104 eamdiskSharedIntegrationSystemdevDataprcImportFactSetFeedsfileList.xml

And this is my code:

<%
'load the XML file..
Option Explicit
Response.Buffer = True
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("\ilife104 eamdiskSharedIntegrationSystemdevDataprcImportFactSetFeedsfileList.xml"))
Dim name, retrieved
name = xml.documentElement.childNodes(0).text
retrieved = xml.documentElement.childNodes(2).text
Set xml = Nothing
%>

It gives the error:

Server.MapPath() error 'ASP 0174 : 80004005'
Invalid Path Character(s)
/ITWeb/Interfaces/je/index.asp, line 9
An invalid '/' or '' was found in the Path parameter for the MapPath method.

View 1 Replies


Similar Messages:

Difference Between Server.MapPath And Page.MapPath?

Sep 23, 2010

What is the difference between those two? If I only want to retrieve the absoluate path to an image on web server, is Server.MapPath safer in any case? I'm using Page.MapPath right now, but it won't work if control was created in WebService since control.Page property become null? Whether Server.MapPath always work?

View 1 Replies

Web Forms :: HttpContext.Current.Server.MapPath Within Server Control Works?

Sep 30, 2010

Does anyone knows why HttpContext.Current.Server.MapPath within a server control works when I run the server control but gives and error whilst in Design mode?

View 2 Replies

How To Use Server.MapPath When HTTPContext .Current Is Nothing

Jan 20, 2011

I have some code that works fine when I need to delete some image files from a directory on my web server:

Dim ImageURL As String = dsImages.Tables(0).Rows(iImgRow).Item("ImageURL")
Dim physicalName = Server.MapPath(ImageURL)
oUpload.DeleteFileFromServer(physicalName, iAdid, iImgID)

.but I am running into a problem when a maintenance task running in a separate thread at set intervals determines that files like the above need to be deleted:

Dim ImageURL As String = dsImage.Tables(0).Rows(i - 1).Item("ImageURL")
Dim iImgID As Integer = dsImage.Tables(0).Rows(i - 1).Item("ImageId")
Dim physicalName As String = HttpContext.Current.Server.MapPath(ImageURL)
oUpload.DeleteFileFromServer(physicalName, iAdID, iImgID)

In this latter case, HttpContext.Current.Server.MapPath(ImageURL) has a value of Nothing.Is there a way to get the full path for this case?

View 1 Replies

Access :: OleDbConnection - Use Server.Mappath

May 6, 2010

I want to make an oledbconnection for my access database. I want to put the connection string in the web.config but I learned that server.mappath does not work in there. I want to use the server.mappath. Can I put the connection sting in a session variable into the global.asax in the session start?

View 2 Replies

Where Does Httpcontext.current.server.mappath Start

Jan 15, 2010

Where does httpcontext.current.server.mappath start?

I don't get it... it doesn't return a path.

My webservice is ran when I debug my application :S.

View 4 Replies

How To Use Server.MapPath To Get Location Outside Website Folder

Aug 6, 2010

When my ASP.NET site uses documents (e.g. XML), I normally load the document as follows:

Server.MapPath("~DocumentsMyDocument.xml")

However, I would like to move the Documents folder out of the website folder so that it is now a sibling of the website folder. This will make maintaining the documents considerably easier.

However, rewriting the document load code as follows:

Server.MapPath("../../Documents/MyDocument.xml")

results in a complaint from ASP.NET that it cannot 'exit above the top directory'.

how I can relatively specify the location of a folder outside the website folder? I really don't want to specify absolute paths for the obvious deployment reasons.

View 4 Replies

State Management :: Using Server.mapPath After Application_End

Jan 13, 2011

in my Global.asax I have a timer and every 24 hours it creates an instance of a class and calls a method to send reminder emails with an attachment. In this method I am getting the current HttpContext and using Server.MapPath to get the path to the attachment, but it is always null. I guess this is because Application_End has been called between the last user accessing the site and the method being called.

As a workaround I am setting the timer interval to 19 minutes but I would rather not call the method 36 times a day when only once is required.

Is there any way, apart from hard coding the path, to ensure the HttpContext is not null?

View 5 Replies

VS 2008 Server.MapPath Returning Incorrect Path?

Apr 17, 2010

The layout of my web app is C:inetpubwwwroot<sln folder><web app folder>. So the image folder in my web app would be the previous path images.

When I try to save to my images folder from a FileUpload control and use Server.MapPath, it drops my <sln folder>, so the path is incorrect. How do I fix this? I figured Server.MapPath just moved up the folder until it hit a drive, no?

View 4 Replies

C# - Server.MapPath() Returning A Path That Does Not Exist When Used With DirectoryInfo?

Jul 20, 2010

I have a virtual directory setup in IIS6. This maps to a shared network drive.

I can correctly map the path using

string mappedPath = HttpContext.Current.Server.MapPath(path);

I then create a DirectoryInfo object as I want to find some files in the directory.

DirectoryInfo updateDirectory = new DirectoryInfo(mappedPath);

But then updateDirectory.Exists is false?? I can take the string from the mappedPath and copy into Start->Run to get to the path so I know it exists. I am authenticating to the webservice using integrated windows authentication and have permissions to the necessary folders.

Is there something obvious I'm missing in the code? Or is this purely set-up and configuration of IIS etc.?

View 2 Replies

Server.MapPath Not Returning Full Path Of A File?

Jan 10, 2011

I have image files stored in "VS_ProjectResourcesImages".

When I use the following code:

String str = Server.MapPath("a.png");
str becomes "VS_Projecta.png".

Why isn't it returning the full path?

View 1 Replies

Web Forms :: Server.MapPath Displays Path As Relative?

May 4, 2010

I have a web application that uses Server.MapPath to specify the exact physical path of as part of upload image.

For example if I do Server.MapPath("/")

I get this:

\boswinfs04homeusersweb2676username

I was expecting something like this:

d:folder

I need to use Server.MapPath not only for image upload but several other uses.

View 2 Replies

Ftp - How To Open A Remote Text File Using Server.MapPath

Mar 21, 2010

This is what I have right now for a file residing on the same server and it works.

Dim FILENAME as String = Server.MapPath("Output.txt")
Dim objStreamWriter as StreamWriter
objStreamWriter = File.CreateText(FILENAME)
dr = myCommand.ExecuteReader()
While dr.Read()
objStreamWriter.WriteLine("{0}|{1}|{2:yyyy-MM-dd}|{3:yyyy-MM-dd}", dr(0), dr(1), dr(2), dr(3))
End While
objStreamWriter.Close()

I was planning on FTPing the file to another server once done but is there a way to do it on a remote server? i.e create a text file on a remote server and write to it? Did not find any instances of that usage. How to use ServerXMLHTTP to replace Server.MapPath in this instance?

View 1 Replies

Does Server.MapPath Behaves Differently In Local Machine And Server Machine

Jul 1, 2010

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:projectsapp1, but I call it in published version, installed in IIS, it returns root directory without any back slash like c:inetpubwwwrootapp1.

string mainRoot = HttpContext.Current.Server.MapPath("~");
DirectoryInfo di = new DirectoryInfo(mainRoot);
//added to solve this problem with Server.MapPath
if (!mainRoot.EndsWith(@""))
mainRoot += @"";
FileInfo[] files = di.GetFiles("*.aspx");
foreach (FileInfo item in files)
{
string path = item.FullName.Replace(mainRoot, "~/").Replace(@"", "/");
//do more here
}

View 1 Replies

DataSource Controls :: How To Use Server.MapPath As Datasource While Creating Connection With OLEDB

Nov 15, 2010

i am trying to create connection using OLEDB connection in my app. but i am not able to create the connection as in datasource i want to use Server.mappath, but cudn't find the right method to use it. i am trying to make connection with Access database file. following is code i have tried:

string path = Server.MapPath("~/uploadaccess/Production.mdb");
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb")&";";
and also
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path&";");
and tried this
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb"));

and this is the error i am getting:

Operator '&' cannot be applied to operands of type 'string' and 'string'

View 3 Replies

What Is Server.mappath(".") In Asp?

Jan 7, 2011

What is server.MapPath() in asp.net.Can any one please explain with example written in Vb.net

View 2 Replies

Where To Use Mappath And Where Not To Use Mappath

Jan 29, 2010

i added a fileupload,a image and a button in my form and i did this code:

Code:

[code]....

and it did not work at all.........

it was just a wild guess to remove the mappath and it worked though

now from the very begining i am having confusion with this mappath.....

so can someone explain me when and where to use mappath and where not to use mappath?

View 15 Replies

Gridview With Textbox Is Accepting Only 30 Characters?

Feb 9, 2010

Im developing a application in asp.net ,the problem i got was i have a grid view with textboxes in it where i can enter some data and store it into the database.But the problem ,i have to enter minimum 50 characters of data into it but the textbox is accepting only 30 characters.im getting the following error.String or binary data would be truncatedThe statement has been terminated.And i have also checked the datatypes of corresponding columns in the database.(they are set to archar(MAX))

View 1 Replies

MVC :: Accepting A Json In A Controller Method?

Oct 10, 2010

I have a JSON object in javascript

it is a collection of Object

How can I pass this object to a controller if i am submitting the form like

$('#myform').submit();

what object type should i give for the parameter to accept this Json

View 5 Replies

Accepting Credit Cards Online?

Jun 11, 2010

i am developing online hotel reservation using asp.net. can any one tell me how to accept directly credit cards like this.example this link.http://www.asiahotel.co.th/reservation/credit_bkk.htm.

View 6 Replies

VS 2005 Accepting Attachments In On Online Form?

Jun 18, 2010

I was wondering what anyone else thinks of this. We are looking at creating an online form with just creates a simple email and fires it off but we would like to give the user the option of sending an attachment. Does anyone have any thoughts on the risks involved with this from a security standpoint? Is there any special products that .net could use to scan files first? some third party application or control?

I have been having trouble finding much good info from google cause, well... You type the words like "email attachment" "risk" or something like that you get so much back it is out of control.

View 5 Replies

Dropdownlist Is Not Accepting New Items When Added Dynamically?

Dec 24, 2010

On adding items in it ,shows an error: "Dropdownlist does not allow multiple selection."But when i tries to print the selected item it shows null exception.

View 6 Replies

Internet Explorer And Chrome Are Not Accepting Cookie

Jan 27, 2011

In my website, I returns a cookie in this way:

context.Response.Cookies.Add(new HttpCookie("MYCOOKIE", MyStringVar)
{
HttpOnly = false,
Expires = DateTime.Now.Add(GlobalSettings.AuthCookieDuration)
});

In development, everything works good in all browsers, but when I deploy the app to a server, only Firefox is able to log in (so it's the only one accepting the cookie). In the server, the app runs on the root of the server, there is not virtual path.

EDIT:
I've looked at it wit Fiddler, and the server is returning the cookie, no doubt. So the problem is that Chrome and IE are not accepting it.

View 1 Replies

ADO.NET :: Accepting Unique Values Only: I Manage To Do It But Is There A More Elegant Way?

Sep 30, 2010

I'll try to make this concise. Anyways, I'm trying to only allow unique data to my database. my database. What I did before adding the entry is to use a Search Query for the value of the txtbox


"SELECT IDnum WHERE IDnum = '" & txtID & "'"

Then compare it with that of the txtbox.

IF objReader("IDNum") <> txtID.textbox then add the entry Else Display a Warning.

in the above code, I can detect the when the user entered an existing value. however, If the user entered a NEW (unique) value an error is Raised "Invalid attempt to read when no data is present" I hit the wall with this.So what I did, Since I can detect Duplicates and have errors when entering unique value, I used the

ON ERROR GOTO statement: I did it like this.

On Error Goto errHandler

If objReader("IDNum") = txtID.textbox then
lbl1.text = "Existing Record"
objReader.close() [code]....

The Code does what I need but its kinda long, I bet there is an elegant way to do this.

View 3 Replies

Accepting SOAP Input As Parameter In Webservice

Nov 11, 2010

I have a webservice method which needs to accept SOAP as input parameter. I've worked webservices between .NET clients but I've never worked using raw SOAP so I don't know what to do. The format of the input like this:

<?xml version="1.0" encoding="utf-8"?>
<S:Envelope xmlns:S = "[URL]/">
<S:Body>
<ns2:RemoteService xmlns:ns2 = "some.ns.url">
<RemoteServiceInput>
<param1>123</param1>
<param2>Asd Qwe</param2>
<param3 xsi:nil = "true" xmlns:xsi = "[URL]"/>
</RemoteServiceInput>
</ns2:RemoteService >
</S:Body>
</S:Envelope>

How should my method input be to accept this SOAP as parameter?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved