Reputation: 13
I am using 2 web servers for my development, 1 publish server and other one is for debugging. They dont have same urls.
I want to make a HttpWebRequest which works on both machines depending which server the code is on. My VS2010 project isnt a web application, so I dont have access to http context.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(rootofwebserver + "/webservices/someservice.asmx/someoperation");
This is what I want.
Is this possible?
Upvotes: 0
Views: 397
Reputation: 215
You can create .txt file and store your url and read again if you need. This is a simple way that i think.
Upvotes: 0
Reputation: 3760
Use AppSettings element to setup your url:
<appSettings>
<add key="WebRequestUrl" value="..." />
</appSettings>
Then in your code you can do:
string webRequestUrl = ConfigurationManager.AppSettings["WebRequestUrl"];
Upvotes: 1