471,599 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

How to provide credentials for writing mxl file to hosted server

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
7 1927
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
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
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
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
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
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
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.

Similar topics

2 posts views Thread by Angelo Vargheese | last post: by
4 posts views Thread by Grind Boy | last post: by
19 posts views Thread by Siobhan | last post: by
2 posts views Thread by cindy.fisher | last post: by
3 posts views Thread by Jay-nospam | last post: by
5 posts views Thread by =?Utf-8?B?SmltbWVy?= | last post: by
reply views Thread by =?Utf-8?B?UG1hX1NoYW5l?= | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

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.