473,388 Members | 1,207 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,388 software developers and data experts.

CacheDuration In WebService?

I successfully created a DLL named "DBServices.dll" using the following
code in a class file:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Services

Namespace DBServices
Public Class DBServiceSettings : Inherits WebService
Private sqlConn As SqlConnection

<WebMethod()Public Function QueryDB(ByVal Query As String) As
DataSet
Dim dSet As DataSet
Dim sqlDapter As SqlDataAdapter

sqlConn = New SqlConnection("Data Source=......")
sqlDapter = New SqlDataAdapter(Query, sqlConn)

dSet = New DataSet
sqlDapter.Fill(dSet, "tblName")

Return dSet
End Function
End Class
End Namespace

This is 1-line code in the ASMX page that uses the above DLL to create
a web service:

<%@ WebService Language="VB" Class="DBServices.DBServiceSettings" %>

As such the above ASMX page gets executed perfectly. When the user
comes to the ASMX page, "QueryDB" is rendered as a link clicking which
the next page displays a TextBox to enter a SELECT SQL query. When the
user clicks the "Invoke" Button in the next page, a new browser window
opens up & displays all the records retrieved by the SQL query in XML
format.

Now I did like to cache the web service. Had the code in the class file
existed in the ASMX page, I could have used the CacheDuration property
of the WebMethod attribute but since the class file encapsulates the
logic, I can't use the CacheDuration property in the WebMethod
attribute.

So how do I cache the web service in this case?

Thanks,

Arpan

Sep 5 '06 #1
0 1001

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a...
0
by: usamedb208 | last post by:
Hello. I have a web method that make a call to database. I set cacheDuration attribute to 0, -1,1, anything but it caches results every time when I make a call to this web method with the same...
1
by: Nalaka | last post by:
Hi, I am testing with Visual studio 2005, web projects. Situation: I have one solution with two web projects, created as file system projects. (I am tesing using the built in server, not IIS)...
0
by: Rob C | last post by:
Hi, I was implementing a simple example of a web service that uses caching: public String CachedString(int input) { return "The time is " + DateTime.Now.ToLongTimeString(); } When I use...
1
by: André Schubert | last post by:
Morning, how can i change the cache duration of a webservice methode dynamically ? THX André
1
by: jonel | last post by:
I have the CacheDuration attribute set for 60 seconds as show below: <WebMethod(CacheDuration:=60, Description:="Method to demonstrate caching")> _ Public Function CachedString(ByVal inputInt As...
7
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure...
3
by: archana | last post by:
hi all. I am having one web service in c#.net where in i am using cacheduration. I have one property as below: get {
0
by: archana | last post by:
Hi all, I am developing one web service and i want to use caching in that. I set cacheduration as 60 seconds. So what i am expecting is withint 60 second if i recalled method it should give...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.