Acessing same class instance from 2 seperate webmethods

T

TiGeR79

Hi,
i've been developing a webservice with 2 seperate webmethods.
The idea is that i have a class which is able to generate a code and also
able to make an image of this code.
Now i'd like to have 2 webmethods ; one which can be called to generate (and
return) the code and one to generate (and return) the image.

The problem im experiencing is that i first make an instance of this class,
then i call the first webmethod (generate code which works fine) after that i
call the second webmehod but instead of making an image out of the code i get
an error because it lost the code. If i place the call to the imagemaking
method in the first webmethod (together with the codegenerating call) it all
works.

Example :

Class UniqueCode

private string uniqueCode;

public void makeUniqueCode()
{
uniqueCode = blah blah my code to make an uniqueid;
}

public Bitmap makeImageFromCode()
{
blah blah my code to make an image of the uniqueCode string;
return uniqueCodeImage;
}

now the webservice :

UniqueCode test = new UniqueCode()

[WebMethod]
public String getCode()
{
string anyCode = test.MakeUniqueCode();
return anyCode;
}

[WebMethod]
public Bitmap getImage()
{
Bitmap testImage = test.makeImageFromCode();
return testImage;
}


any idea how i can solve my problem ? seems like some scope issue or
something, the instance of the class exists (with its global variable
uniquCode) during the call to the first webmethod but seems like it gets
reset befor the call to the second webmethod....
 
T

TiGeR79

First of all thanks for answering...
Unfortunately I have no experience at all managing cached data...
This is my first big project implementing webservices...
So would you be so kind to point me to some information about cache
managment and/or cache retrieval as you mean it ?
Thanks in advance...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,832
Latest member
UtaHetrick

Latest Threads

Top