Unable to open text file

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I am getting the following error when trying to open a text file:

Overload resolution failed because no accessible 'New' can be called without
a narrowing conversion

The code is:
*******************************************************
Dim objStreamWriter As StreamWriter

objStreamWriter = New StreamWriter(Server.MapPath("\uploads") & "\" &
"Report" & session("User").UserName & DateTime.now.toString("yyddMM"))
*******************************************************

This works in other programs.

What does the message mean?

Thanks,

Tom
 
It's probably because it can't determine the data type of the operand.

What does Session("User") contain? When you read the value it will have
the data type Object, and there is no UserName property in the Object
class. You have to specify the actual type of the data.
 
Back
Top