473,387 Members | 1,890 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,387 software developers and data experts.

Read xml from a password protected site

Hi;

If I need to parse an xml file from a password protected site - like:
XmlReader xmlReader = XmlReader.Create("http://www.cia.gov/AgentList.xml",
readerSettings);

How do I pass in the username/password so it can get the url?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Jun 5 '06 #1
9 2625
Hi Dave,

This depends on what kind of authentication the server is requiring. Is it
using forms authentication or just basic ones?

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 5 '06 #2
Hi;

It could be anything. We let users enter a url and then we go to pull the
xml from the url they gave us.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

"Kevin Yu [MSFT]" wrote:
Hi Dave,

This depends on what kind of authentication the server is requiring. Is it
using forms authentication or just basic ones?

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 5 '06 #3
David Thielen wrote:
Hi;

If I need to parse an xml file from a password protected site - like:
XmlReader xmlReader = XmlReader.Create("http://www.cia.gov/AgentList.xml",
readerSettings);

How do I pass in the username/password so it can get the url?


http://hhoover:cr********@www.cia.gov/AgentList.html

///Peter

Jun 5 '06 #4
Hi Dave,

In this case, you need to use XmlDocument class, to get the xml from that
URL. There is a property named XmlResolver, which you can specify an
XmlUrlResolver object. Then you can specify the Credentials for that
resolver. For more information, you can check the following link:

http://msdn2.microsoft.com/en-us/lib...lver.credentia
ls.aspx

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 6 '06 #5
I think that's the one for the fbi, not the cia <g>.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

"Peter Flynn" wrote:
David Thielen wrote:
Hi;

If I need to parse an xml file from a password protected site - like:
XmlReader xmlReader = XmlReader.Create("http://www.cia.gov/AgentList.xml",
readerSettings);

How do I pass in the username/password so it can get the url?


http://hhoover:cr********@www.cia.gov/AgentList.html

///Peter

Jun 6 '06 #6
that's it - thanks - dave

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

"Kevin Yu [MSFT]" wrote:
Hi Dave,

In this case, you need to use XmlDocument class, to get the xml from that
URL. There is a property named XmlResolver, which you can specify an
XmlUrlResolver object. Then you can specify the Credentials for that
resolver. For more information, you can check the following link:

http://msdn2.microsoft.com/en-us/lib...lver.credentia
ls.aspx

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 6 '06 #7
You're welcome.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 7 '06 #8
Hi;

If I need to parse an xml file from a password protected site - like:
XmlReader xmlReader = XmlReader.Create("http://www.cia.gov/AgentList.xml",
readerSettings);

How do I pass in the username/password so it can get the url?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
HttpWebRequest myHttpWebRequest;
NetworkCredential netCred = new NetworkCredential("username", "password", "domainname");
myHttpWebRequest = (HttpWebRequest)WebRequest.Create(protectedWebSite URL);
myHttpWebRequest.Credentials = netCred;
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
Stream data = myHttpWebResponse.GetResponseStream(); System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader reader = new StreamReader(data, encode);
FileStream fs = File.Create(Server.MapPath(fileName));
StreamWriter sw = new StreamWriter(fs);
sw.Write(reader.ReadToEnd());
sw.Close();
fs.Close();

Posted from http://www.topxml.com/renntp using reNNTP: the website based NNTP reader.
Jul 21 '06 #9
thank you

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

"Natrajan" wrote:
>
Hi;

If I need to parse an xml file from a password protected site - like:
XmlReader xmlReader = XmlReader.Create("http://www.cia.gov/AgentList.xml",
readerSettings);

How do I pass in the username/password so it can get the url?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

HttpWebRequest myHttpWebRequest;
NetworkCredential netCred = new NetworkCredential("username", "password", "domainname");
myHttpWebRequest = (HttpWebRequest)WebRequest.Create(protectedWebSite URL);
myHttpWebRequest.Credentials = netCred;
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
Stream data = myHttpWebResponse.GetResponseStream(); System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader reader = new StreamReader(data, encode);
FileStream fs = File.Create(Server.MapPath(fileName));
StreamWriter sw = new StreamWriter(fs);
sw.Write(reader.ReadToEnd());
sw.Close();
fs.Close();

Posted from http://www.topxml.com/renntp using reNNTP: the website based NNTP reader.
Jul 21 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rickard | last post by:
OK. I have the need on a form submit to pass the data to anther system that require a login and password only I want to automate the process in an server side asp file and then process the...
3
by: netsurfer | last post by:
hi..I'm working on a project that requires files to be password protected on a UNIX based site. The people that own the web site want to be able to change the password every so often. ...
2
by: RICHARD BROMBERG | last post by:
I am building a password protected ASP web site. (http://www.allscrewedup.org) When you go to this site there is a link in upper left corner (VIP) that takes you to a Logon Screen. The user...
5
by: Gelios | last post by:
Hello All! I am going to crazy and feeling myself so stupid but I don't understand such behaviour. I have code: public int getNextAgentId() { Int32 agent_id = 0; IDataReader dr =...
2
by: Morten | last post by:
Hi! I'm wondering what it is that makes IE prompt users to save user name and password. I have a web site coded in C#/.Net and part of it is protected by means of a form. When I key in user name...
5
by: Darren | last post by:
Hello, we're fully paid up and signed up to a password protected site, so this isn't hacking. In this site we can download a price list in CSV format. What I'd like to do is have a PHP...
4
by: connoisseur.infotech | last post by:
hello we are developing one tool where we need to open and make password protected zip files. we found some solutions but they don't support password protected things. does any one knows about...
4
by: apondu | last post by:
I'm trying to screen scrape a site that requires a password. I am using C#.Net, i am new to this and with the information available around on the internet i just put tht information into the...
1
by: denniswong288 | last post by:
Hi, My website has PDF documents that's available for registered users to view online (through my site) only. Currently, I can't find any solutions to prevent users from downloading/"save-as"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.