Dear Friends,
I have a webservice where i am using a
Session("BaseCurrency")
variable inside a method.
When the user call this Web Service Method which uses the
Session("BaseCurrency")
variable then an error occurs:-
"Object reference not set to an instance of an object.".
I am aware that this variable value is not initialized that is why this error is coming but i have to use this variable value in my method as the value for different companies are different.
The user can consume this webservice for any company and also the
Base Currency could be different for different company.
Please find the code below:-
Public Class MISService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function InsertMIS(ByVal strMis1 As String, ByVal strMis2 As String, ByVal strMis3 As String, ByVal pardoc As String, ByVal csid As String) As Object
Dim objMIS As New Prj_misrgp.cls_misrgp
Try
Dim strMis As String = strMis1 + strMis2 + strMis3
strMis = strMis.Replace("APPglcost", Application("Glcostset"))
strMis = strMis.Replace("APPcurcost", Application("curcostset"))
Return objMIS.save(strMis, pardoc, "MIS", "4.3.3", csid, "", "", Session("BaseCurrency"))
Catch ex As Exception
Return ex.Message
Finally
objMIS = Nothing
End Try
End Class
End Function
Please help me resolve this issue.
Thanks
Varun Sareen