简体   繁体   中英

Using variables from aspx.vb(behind code) to aspx file

I am trying to pass lvsession from the codebehind to aspx file. It keeps telling me is not declared or inaccessible due to its protection level. I've tried making it a Public variable at the class level and still no luck. I am really new to asp.net so thanks in advance.

Default.aspx

   <object xmlns: id="viewer" classid="clsid:d4290153-c4b5-4c27-9d66-44e94d6b0c32"
   codebase="" height="700" name="viewer" width="800">
   <param name="ServiceHandlerURL" value="" />
   <param name="SessionID" value="<%lvsession%>" />
   <param name="DocumentID" value="180484" /> 
   </object>
</body>

</asp:Content>

Default.aspx.vb

Public Class WebForm1
Inherits System.Web.UI.Page
Public Property lvsession As String

Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim authProps As OnBaseAuthenticationProperties = Hyland.Unity.Application.CreateOnBaseAuthenticationProperties("https://test.com/", "Manager", "password", "Test")
    Dim app As Hyland.Unity.Application = Hyland.Unity.Application.Connect(authProps)



    lvsession = app.SessionID
End Sub

End Class

Update: When I use <%lvsession%> it returns me error and when I use this format it returns me the desired value. <%: lvsession %>

Public Property lvsession As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    lvsession = DateTime.Now.Year.ToString()
End Sub

So I don't think the problem is related to lvsession unless it works in <%: lvsession %> format.

Can you try :

Dim app As New Hyland.Unity.Application
app.Connect(authProps)

And thank you @mason for your suggestion. Bu my answer was suggesting to create an instance and I think it was clear even if it is short:

I suppose you should create an instance of your lvsession

please see [this answer] 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM