471,089 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

XmlDataSource & Website Proxy

Hello,

How do you set the website proxy using the XmlDataSource control?

Thanks, sck10
Oct 10 '06 #1
2 7353
Hello Steve,

As for the XmlDataSource control, it doesn't expose a property for us to
configure webproxy to access external web resource. Actually, the
XmlDataSource control is designed for accessing local file document or
string based Xml content mostly. For your scenario, if your XMLDataSource
want to retrieve XML Data from an external site that need to be resolved
through a proxy, you can consider the following options:

1. Since by default the XMLDatasource control will use the system proxy
setting (within the machine level .net framework system.net configuration),
we can override it in our web application's web.config file. For example:

=================================
<system.net>
<defaultProxy >
<proxy
proxyaddress="http://jpnproxy:80"
bypassonlocal="True"
/>

</defaultProxy>
</system.net>
=======================

or if you do not want to make this setting affect all pages in the
application(only for individual pages or a sub directory), you can use the
<locationelement to scope the setting:

=============
<location path="XML/RSSDataSource.aspx">
<system.net>
<defaultProxy >
<proxy
proxyaddress="http://jpnproxy:80"
bypassonlocal="True"
/>

</defaultProxy>
</system.net>
</location>
=====================
2. You can also programmtically use WebRequest component(which can accept a
explicit webproxy setting) to retrieve the XML content and then assign it
to the XmlDataSource.Data property programmtically. e.g.

================
protected void Page_Load(object sender, EventArgs e)
{

//use webrequest to get the XML
string xml = GetXMLFromRemoteUrl(...);

XmlDataSource1.Data = xml;
}
================

Hope this helps. If there is any other questions, please feel free to let
me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

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

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

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

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

Oct 11 '06 #2
Thanks Steven,

Appreciate the help...

Regards, sck10

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:1g**************@TK2MSFTNGXA01.phx.gbl...
Hello Steve,

As for the XmlDataSource control, it doesn't expose a property for us to
configure webproxy to access external web resource. Actually, the
XmlDataSource control is designed for accessing local file document or
string based Xml content mostly. For your scenario, if your XMLDataSource
want to retrieve XML Data from an external site that need to be resolved
through a proxy, you can consider the following options:

1. Since by default the XMLDatasource control will use the system proxy
setting (within the machine level .net framework system.net
configuration),
we can override it in our web application's web.config file. For example:

=================================
<system.net>
<defaultProxy >
<proxy
proxyaddress="http://jpnproxy:80"
bypassonlocal="True"
/>

</defaultProxy>
</system.net>
=======================

or if you do not want to make this setting affect all pages in the
application(only for individual pages or a sub directory), you can use the
<locationelement to scope the setting:

=============
<location path="XML/RSSDataSource.aspx">
<system.net>
<defaultProxy >
<proxy
proxyaddress="http://jpnproxy:80"
bypassonlocal="True"
/>

</defaultProxy>
</system.net>
</location>
=====================
2. You can also programmtically use WebRequest component(which can accept
a
explicit webproxy setting) to retrieve the XML content and then assign it
to the XmlDataSource.Data property programmtically. e.g.

================
protected void Page_Load(object sender, EventArgs e)
{

//use webrequest to get the XML
string xml = GetXMLFromRemoteUrl(...);

XmlDataSource1.Data = xml;
}
================

Hope this helps. If there is any other questions, please feel free to let
me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

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

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

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

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

Oct 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Snuffy2 | last post: by
2 posts views Thread by Zulander | last post: by
5 posts views Thread by sck10 | last post: by
1 post views Thread by Disccooker | last post: by
8 posts views Thread by Wessel Troost | 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.