473,397 Members | 2,033 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,397 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 7439
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Snuffy2 | last post by:
I'm looking to try to get a users MAC and/or NetBIOS name when they visit my website. It somehow can be done, I'm not sure with PHP, but it can be done. Does anyone have any idea how? As an...
0
by: W. Kacy | last post by:
I am having trouble using XML in an ASP.NET 2.0 webform. Using ASP.NET 2.0 beta 2, I have created a blank web page in a C# website. I have added an XML file (soData.xml), structured as follows: ...
2
by: mike | last post by:
can somebody please show me some code that will let me populate a checkboxlist from the xmldatasource, and have the text property set to the names in the xml file thanks you can also email me...
3
by: Brian | last post by:
Using external XML, I'm trying to build a quiz, but I can't seem to specify the DataSource for the RadioButtonList within a Repeater ItemTemplate. I've tried a number of approaches, but I haven't...
2
by: Zulander | last post by:
hi, i am trying to put a session variable in the DataFile of the XmlDataSource, but for some reason i am getting: Server tags cannot contain <% ... %constructs. <asp:XmlDataSource...
5
by: sck10 | last post by:
Hello, I am using the following to get RSS Feeds. I've been able to get the xml files from every site except CNN. When I try to get there feed, I get the exception: A column named 'link'...
1
by: Disccooker | last post by:
i am trying to use XPath and the XMLDataSource to display data from an XMLDocument and am getting nowhere. What i would like to do is have a repeater display a label for Seed, label for Team Name...
0
by: pompair | last post by:
Hello, I'm making a quiz game for fun. I have an xml file like this: <?xml version="1.0" encoding="utf-8" ?> <results> <index>99</index> <answers>11</answers> <questions> <question id="1">
8
by: Wessel Troost | last post by:
We are using an XML data source in the Page_Load event of an ASP.NET page, like: protected void Page_Load(object sender, EventArgs e) { // Retrieve XML from web service for product idea in URL...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.