We have created a custom assembly that creates a
FormAuthenticationTicket object. When calling the custom assembly from
an expression for "Jump to URL", the preview returns "Invalid URI: The
hostname could not be parsed" error message.
The FormsAuthenticationTicket is in System.Web.Security, which is
within the System.Web.dll that I have added a reference to within the
report designer.
If I comment out the FormsAuthenticationTicket lines in the custom
assembly, previewing the report runs just fine.
My question is: what do I need to do to get the Report Designer to have
the ability to create the FormsAuthenticationTicket?
Thanks,
NateI should note that the FormsAuthenticationTicket object is used in the
method, but we are returning a string from the method, not the ticket
object itself.
The problem boils down to the fact that ReportServices can not find
System.Web.Security, which is in System.Web referenced within the
report.
Thanks,
Nate|||Sending up the white flag...
I have switched from custom assembly to custom code (Code Tab in Report
Properties). Here's the code:
---
Public Function GetDetailReportUrl(ByVal strUrl As String) As String
'Dim objTkt As System.Web.Security.FormsAuthenticationTicket
Dim strTkt As String
Dim strTktData As String
Dim intVersion As Int32
Dim strName As String
Dim dtIssued As DateTime
Dim dtExpiry As DateTime
Dim bIsPersistent As Boolean
Dim strUserData As String
strTktData = strUrl + "|" + DateTime.Now.AddHours(1).ToString()
intVersion = 1
strName = "ruser"
dtIssued = DateTime.Now
dtExpiry = DateTime.Now.AddMinutes(30)
bIsPersistent = False
strUserData = strTktData
Try
Dim objTkt as System.Web.Security.FormsAuthenticationTicket
= New System.Web.Security.FormsAuthenticationTicket(intVersion,
strName, dtIssued, dtExpiry, bIsPersistent,strUserData)
'strTkt =System.Web.Security.FormsAuthentication.Encrypt(objTkt)
Catch ex As Exception
strUrl = strUrl & "&error=" & ex.ToString
Finally
strUrl = strUrl & "&tkt=" & strTkt
End Try
GetDetailReportUrl = strUrl
End Function
---
It is failing when I am trying to instantiate the
FormsAuthenticationTicket. If I comment out the lines pertaining to
objTkt and the Encrypt() call, but leave the declaration of objTkt, no
problems.
Here's the error:
System.NullReferenceException: Object reference not set to an instance
of an
object.
at System.Web.Security.FormsAuthentication.Initialize()
at System.Web.Security.FormsAuthenticationTicket..ctor(Int32 version,
String name, DateTime issueDate, DateTime
expiration, Boolean isPersistent, String userData)
The problem is with the FormsAuthenticationTicket constructor calling
FormsAuthentication.Initialize(). It's as if the constructor either
can't create the FormsAuthentication object, or is trying to access an
object it thinks already exists.
Any help out there?
- Nate
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment