Last post Aug 24, 2011 02:10 AM by shashankgwl
Aug 24, 2011 01:24 AMemail@example.com|LINK
i have a website in which i am taking a refrence of a WCF service. now i want to create a single object per user of this service (means i don't want to create object on every webform whereever required for all the users).
one solution i can think of to declare the objects into global.asax and transport them through session variable.
Please let me know if anyone know any better solutions of doing this.
Thanks in advance.
Aug 24, 2011 02:10 AM|shashankgwl|LINK
1. you can create a base page class for all pages and declare a property there which returns a reference to service object.
2. session work can also be done as you mentioned , but it won't be my preferred way.
3. you can write a class which returns you a reference , that class can read a config file and decide which reference to return, this way you can customize your application if the WS configuration changes in future.