ToDotNet

Convert.ToDotNet(InstanceOfWorld)

  Home :: Contact :: Syndication  :: Login
  174 Posts :: 0 Stories :: 175 Comments :: 22 Trackbacks

News





My Vista Score...
3.4




Archives

Post Categories

Image Galleries

Affiliations

Blogs I Read

Interesting Links

My Links

Here's something I found out today. Sure, it's been sitting in the helpfile, but I never saw it. There a property you can set with a webreference called UrlBehavior. The value of this property determines whether the URL of a Web reference is hard-coded into the generated Visual Basic or Visual C# proxy code.

When set to webrefUrlBehaviorDynamic, you can set the url of the webservice in the app.config file like this.

<configuration>
   <appSettings><add key="SomeProject.localhost.Service1"
      value="
http://localhost/SomeWebService/Service1.asmx"/>
   </appSettings>
</configuration>

No need to recompile your app. You learn something everyday.

posted on Thursday, November 20, 2003 9:43 AM



Feedback

# re: UrlBehavior 12/1/2003 8:44 AM beliwan
bedankt,

was een vraag op het examen 70-320!!

# re: UrlBehavior 4/1/2004 1:03 PM Phuong
Can you give me your code to solve this problem. I saw this information in MSDN but I can not find any sample. If you have already known exacly what to do with this property, please show me because I don't have many time to search for detail now. Thanks so much!

# re: UrlBehavior 4/1/2004 1:08 PM Phuong
I don't know how to contact you! So i use feedback. Please contact me via kimphuong2911@yahoo.com

# re: UrlBehavior 4/1/2004 1:18 PM Sander
@Phuong:
What you do is this:
1. you add a webreference to your project like you would normally do
2. select the reference and check the properties
3. at URL Behavior, change the setting to Dynamic
4. add a key to your App.config or Web.config file (App.config is for client apps), like in this posting.
5. set the key-value to the name of the reference, set the value-value to the location of the webservice.
That's it.


# re: UrlBehavior 4/2/2004 4:12 AM Phuong
I forgot to tell you that my application is deployed on PDA. So when I check the properties of the reference I can not find URL Behavior.

# re: UrlBehavior 4/2/2004 6:09 AM Phuong
By the way, do you know the usage of URL property? I had tried to use this property to reset the url of my web reference but I was failed. I have 2 web services located on 2 servers, how can I indicate which of them I want to create reference to?

# re: UrlBehavior 4/2/2004 8:54 AM Sander
So you're using the Compact Framework, of which I know very little. Perhaps URL Behavior is not supported on a CF-application. In that case you may want to check out
http://www.xmlwebservices.cc/index_Samples.htm
under "Dynamically invoke XML Web Services".
As for the usage of URL property, same advice. Check out Christian Weyers solution on his site, although I'm not sure if it'll work on a PDA.

Post Feedback

Title:
Name:
Url:
Comments: 
Protected by Clearscreen.SharpHIPEnter the code you see: