This is a discussion on WebServices in DotNet within the ASP and ASP.NET Programming forums, part of the Web Development category; Yes ... You can control it through the web.config file. What you do is right click your Web Reference, and ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Yes ... You can control it through the web.config file. What you do is right click your Web Reference, and select properties. Then change the Web Service Url From Static to Dynamic. Once that happens you will see something new in the web.config file, which will contain the URL for the web service, and allow you to change it through the config file.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| Sponsored Links |
| |||
| I have a web service that posts data somewhere, however, I want the ability to turn this off on the fly without having to change a value in web.config or going in and flipping some flag in the database and then having to hit the DB every time to check for the value. So right now I have a web method that simply changes a value and caches it, so if I want to turn it on/off all I have to do is hit webservice.asmx and run a "test" of the operation. I just pass in the number of minutes which determines how long the value is cached for and thats it. So if I put 30, it inserts a given value in the cache for 30 minutes, and each time my web service goes to post the data, it first checks to see if this value exists in cache and if it does it does not try posting the data. Simple enough. One problem though, in my function that checks to see if this value exists in cache I'm checking by saying something like: If HttpContext.Current.Cache.Item("myKey") = "1" Then Its off, return false This would work great, only problem is that the process that calls this web service is a background thread, so there is no HttpContext. So even though my value might exist in cache, it never works. Does anyone know of a solution I could use instead? I'm using vb.net, 1.1. Any input is greatly appreciated. Thanks.
__________________ J.Saravanan |
| |||
| I think I understand your problem. Looks like you need to find another place to cache your variable. You say you don't want to use a database. You say you don't want to use the web.config. So you opt for using the httpcontext cache which goes away after your http request to the webservice has ended. Yep, once you get your response back from your webservice **POOF**, your cache value is kaput. Not a particularly good idea. So, find another place to cache your variable. |
| |||
| You can always access the cache through HttpRuntime.Cache instead, or why not just use a static member variable the HttpApplication class (Global.asax)
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| HttpRuntime.Cache is the same cache. The property "Cache" on HttpContext is: Code: public Cache Cache
{
get
{
return HttpRuntime.Cache;
}
}
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| You can use as follows, Code: service.TimeOut=15000; // Here service is object of ur WebService
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Easy Property Class Generator for DOTNET Developers | Anandavinayagam | ASP and ASP.NET Programming | 4 | 01-16-2008 03:54 AM |
| What is Ngen.exe in DotNet? | leoraja8 | VB.NET Programming | 11 | 10-31-2007 02:17 AM |
| OOPs Tips for DotNet. | S.Vinothkumar | Interview Questions & Answers and Tips | 11 | 10-29-2007 07:20 AM |
| Transaction Scope in DotNet using C#. | S.Vinothkumar | C# Programming | 52 | 09-22-2007 01:15 AM |
| Does Using Json Instead Of Xml Speeds Up Webservices Architecture | ramkumaraol | HTML, CSS and Javascript Coding Techniques | 0 | 07-18-2007 02:59 AM |