By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,876 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,876 IT Pros & Developers. It's quick & easy.

How to provide credentials for writing mxl file to hosted server

P: n/a
I would like to be able to update an xml file located on my hosted server
from my local computer.

The server requires a user name and password to access the web site for
writing or updating files.

Could someone refer me to a doc that explains this or provide some sample
code?

Thanks,

Dennis
Nov 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hello there.

I believe that you should use the XmlValidatingReader class. To use this
object, you should first load an XmlTextReader object with the appropiate
document. When an XmlValidatingReader object is instantiates, the
XmlTextReader object supplies the XML document. Next, you should set the
ValidationType property of the XmlValidatingReader object so that it will
know how to properly validate the XML doc. In your scenario, you need to
supply a user name and passwd in order to access the XML doc and maybe the
schema file? To accomplish this, you must supply credentials to the
XmlResolver property of the XmlValidatinReader object. However, it's not
possible to retrieve credentials FROM the XmlResolver property.

How can you do this? By using the object NetworkCredential assigned to the
property Credentials of the XmlResolver.

Here is a code sample that you may use.

XmlTextReader myTextReader = new
XmlTextReader("//YouServer/yourXMLFile.xml");
XmlValidatongReader myValidatingReader = new
XmlValidatingReader(myTextReader);
MyValidatingReader.ValidationType = ValidationType.Schema;
NetworkCredential myCredentials = new NetworkCredential(strUserName,
strPasswd, strDomain);
myValidatingReader.XmlResolver.Credentials = myCredentials;

voilá, there you should have access to the file you need.

Hope this helps

Steven Lewis

"Dennis C. Drumm" <dc******@community.nospam> escribió en el mensaje
news:%2****************@TK2MSFTNGP09.phx.gbl...
I would like to be able to update an xml file located on my hosted server
from my local computer.

The server requires a user name and password to access the web site for
writing or updating files.

Could someone refer me to a doc that explains this or provide some sample
code?

Thanks,

Dennis

Nov 17 '05 #2

P: n/a
Steven:

Isn't a reader for reading files not writing them. I want to write to an xml
file located on my hosted server (one that is not part of my office's
domain.

Thanks,

Dennis
"Steven Lewis" <am*******@hotmail.com> wrote in message
news:eC*************@TK2MSFTNGP15.phx.gbl...
Hello there.

I believe that you should use the XmlValidatingReader class. To use this
object, you should first load an XmlTextReader object with the appropiate
document. When an XmlValidatingReader object is instantiates, the
XmlTextReader object supplies the XML document. Next, you should set the
ValidationType property of the XmlValidatingReader object so that it will
know how to properly validate the XML doc. In your scenario, you need to
supply a user name and passwd in order to access the XML doc and maybe the
schema file? To accomplish this, you must supply credentials to the
XmlResolver property of the XmlValidatinReader object. However, it's not
possible to retrieve credentials FROM the XmlResolver property.

How can you do this? By using the object NetworkCredential assigned to the
property Credentials of the XmlResolver.

Here is a code sample that you may use.

XmlTextReader myTextReader = new
XmlTextReader("//YouServer/yourXMLFile.xml");
XmlValidatongReader myValidatingReader = new
XmlValidatingReader(myTextReader);
MyValidatingReader.ValidationType = ValidationType.Schema;
NetworkCredential myCredentials = new NetworkCredential(strUserName,
strPasswd, strDomain);
myValidatingReader.XmlResolver.Credentials = myCredentials;

voilá, there you should have access to the file you need.

Hope this helps

Steven Lewis

"Dennis C. Drumm" <dc******@community.nospam> escribió en el mensaje
news:%2****************@TK2MSFTNGP09.phx.gbl...
I would like to be able to update an xml file located on my hosted server
from my local computer.

The server requires a user name and password to access the web site for
writing or updating files.

Could someone refer me to a doc that explains this or provide some sample
code?

Thanks,

Dennis


Nov 17 '05 #3

P: n/a
Hi Dennis,

As for create/modify file/document on webserver, we can not use the buildin
file system(system.io) or xml (system.xml) apis in .net framework to do it.
In fact, normally, the webserver won't allow HTTP protocal based file
manipulation on server. As far as I know, the only available means
(manipulating documents on webserver through http protocal ) are using the
WEBDAV which is a publish standard that many servers (IIS, exchange ...)
has supported ).

WebDav is rely on XML, when we want to create/ update files/resources on a
certain server, we just send WebDav message to the server , the message is
xml based and can be sent through HTTP request. For detailed info on
WebDav, you can have a look at the following site:

# WebDAV Resources
http://www.webdav.org/

And currently the latest IIS server support communicattion with webdav. We
need to do some configuration on the serverside so as to enable the WebDav
and then using the proper component to send the XML based webdav requests
to server. Here are some tech articles discussing on the related info:

#Using WebDAV with IIS
http://www.wown.com/articles_tutorials/WebDAV-IIS.html

#Communicating XML Data over the Web with WebDAV
http://msdn.microsoft.com/library/en...bdav.asp?frame
=true

In addition, to make things convenience, if it's ok to provide a certain
public dyanmic webpage or webservice on the webserver(in your scenario),
I'd rather recommend that you publish such a dynamic webpage/webservice
which will do the actual file manipulation tasks on the server, then all
the client apps just need to interact with that page/service.

How do you think? If there're anything unclear, please feel free to post
here. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



Nov 17 '05 #4

P: n/a
Hi Dennis,

Have you got any further ideas on this question? Does the things I posted
in the previous message helped?
If there're any thing else we can help, please feel free to post here.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 17 '05 #5

P: n/a
Sorry for the delay responding, I was away from the office for a couple of
days.

Anyway, the response above does not seem appropriate, since he suggests
adding credentials for a reader not a writer. I don't see how that will help
me to update or write to an xml document on my hosted server, a server that
has a web address versus a local domain address for my office.

So, yes, I would appreciate a little more information on this subject.

thanks,

Dennis
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:WV**************@TK2MSFTNGXA01.phx.gbl...
Hi Dennis,

Have you got any further ideas on this question? Does the things I posted
in the previous message helped?
If there're any thing else we can help, please feel free to post here.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 17 '05 #6

P: n/a
Hi Dennis,

Of course what I meant were not what Steven Lewis has mentioned(using
XmlDocument or XmlReader/XmlWriter.... ), that's not possible for
modifying serverside document/files.

Have you viewed my last message which mentioned the WebDav and some other
approachs(which require a certain dynamic page on the server) ? Anyway,
I'll repaste my previous reply here for your reference:
======================
As for create/modify file/document on webserver, we can not use the buildin
file system(system.io) or xml (system.xml) apis in .net framework to do it.
In fact, normally, the webserver won't allow HTTP protocal based file
manipulation on server. As far as I know, the only available means
(manipulating documents on webserver through http protocal ) are using the
WEBDAV which is a publish standard that many servers (IIS, exchange ...)
has supported ).

WebDav is rely on XML, when we want to create/ update files/resources on a
certain server, we just send WebDav message to the server , the message is
xml based and can be sent through HTTP request. For detailed info on
WebDav, you can have a look at the following site:

# WebDAV Resources
http://www.webdav.org/

And currently the latest IIS server support communicattion with webdav. We
need to do some configuration on the serverside so as to enable the WebDav
and then using the proper component to send the XML based webdav requests
to server. Here are some tech articles discussing on the related info:

#Using WebDAV with IIS
http://www.wown.com/articles_tutorials/WebDAV-IIS.html

#Communicating XML Data over the Web with WebDAV
http://msdn.microsoft.com/library/en...bdav.asp?frame
=true

In addition, to make things convenience, if it's ok to provide a certain
public dyanmic webpage or webservice on the webserver(in your scenario),
I'd rather recommend that you publish such a dynamic webpage/webservice
which will do the actual file manipulation tasks on the server, then all
the client apps just need to interact with that page/service.

How do you think? If there're anything unclear, please feel free to post
here. Thanks,

======================

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 17 '05 #7

P: n/a
Hi Dennis,

Of course what I meant were not what Steven Lewis has mentioned(using
XmlDocument or XmlReader/XmlWriter.... ), that's not possible for
modifying serverside document/files.

Have you viewed my last message which mentioned the WebDav and some other
approachs(which require a certain dynamic page on the server) ? Anyway,
I'll repaste my previous reply here for your reference:
======================
As for create/modify file/document on webserver, we can not use the buildin
file system(system.io) or xml (system.xml) apis in .net framework to do it.
In fact, normally, the webserver won't allow HTTP protocal based file
manipulation on server. As far as I know, the only available means
(manipulating documents on webserver through http protocal ) are using the
WEBDAV which is a publish standard that many servers (IIS, exchange ...)
has supported ).

WebDav is rely on XML, when we want to create/ update files/resources on a
certain server, we just send WebDav message to the server , the message is
xml based and can be sent through HTTP request. For detailed info on
WebDav, you can have a look at the following site:

# WebDAV Resources
http://www.webdav.org/

And currently the latest IIS server support communicattion with webdav. We
need to do some configuration on the serverside so as to enable the WebDav
and then using the proper component to send the XML based webdav requests
to server. Here are some tech articles discussing on the related info:

#Using WebDAV with IIS
http://www.wown.com/articles_tutorials/WebDAV-IIS.html

#Communicating XML Data over the Web with WebDAV
http://msdn.microsoft.com/library/en...bdav.asp?frame
=true

In addition, to make things convenience, if it's ok to provide a certain
public dyanmic webpage or webservice on the webserver(in your scenario),
I'd rather recommend that you publish such a dynamic webpage/webservice
which will do the actual file manipulation tasks on the server, then all
the client apps just need to interact with that page/service.

How do you think? If there're anything unclear, please feel free to post
here. Thanks,

======================

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.