Windows VB.NET application to execute a Domino URL (2nd Post)

I need to use a Windows VB.NET application to execute a Domino URL . The URL open the report in Windows VB.NET if anonymous has a admin role , but if I reomve the admin role and assign as editor it did not work.

Following is code I am running in button to open the URL.

window.open(“http://” + parent.IncidentReportContents.document.forms[0].ReportServer.value + “/IncidentReports/GetIR.aspx?UNID=” + parent.IncidentReportContents.document.forms[0].UNID.value + “&Report=IREntireReport&srcip=” + parent.IncidentReportContents.document.forms[0].Server_Name.value + “&ViewPath=/” + parent.IncidentReportContents.document.forms[0].DBPath.value + “/IncidentReportXML”);

I saw following code in one of other post, but not sure how to use the import in Lotus script…

Given that scenario, here’s what I attempted so far using your code (with the first intent of just authenticating via the app):

Imports System.Xml

Imports System.Net

Imports System.IO

Imports system.web

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If AuthenticateUserAgainstMaster() Then

MsgBox(“worked”)

Else

MsgBox(“failed”)

End If

End Sub

Private Function AuthenticateUserAgainstMaster() As Boolean

Dim req As HttpWebRequest

Dim res As System.Net.HttpWebResponse

'Dim sr As System.IO.StreamReader

Dim cookieContainer As New System.Net.CookieContainer

'Dim securityToken As String

Dim postDataByte As Byte()

Dim postStream As Stream

Dim retCode As Boolean = False

Dim _AuthorizationCookie As System.Web.HttpCookie

Dim _loginURL = “http://mydominoserver.com/webapps/ContactsXML.nsf/GetContactXML?openagent&date=04/13/2006

Dim _username = “joe.user”

Dim _password = “mypassword”

Dim _authorizationCookieName = “LTPAToken”

Try

System.Net.ServicePointManager.Expect100Continue = False

req = CType(WebRequest.Create(_loginURL), HttpWebRequest)

req.CookieContainer = New CookieContainer

'enncode the form data string into a byte array ’

postDataByte = System.Text.Encoding.ASCII.GetBytes(“username=” & _

System.Web.HttpUtility.UrlEncode(_userName) & _

“&password=” & _

System.Web.HttpUtility.UrlEncode(_password))

'indicate that you will be posting the data

req.Method = “POST”

req.ContentType = “application/x-www-form-urlencoded”

req.ContentLength = postDataByte.Length

req.AllowAutoRedirect = False

'send the form

postStream = req.GetRequestStream()

postStream.Write(postDataByte, 0, postDataByte.Length)

’ Close the post

postStream.Close()

res = CType(req.GetResponse(), HttpWebResponse)

res.Cookies = req.CookieContainer.GetCookies(req.RequestUri)

If Not res.Cookies(_authorizationCookieName) Is Nothing Then

Dim responseCookie As Cookie = res.Cookies.Item(_authorizationCookieName)

Dim passThruCookie As New System.Web.HttpCookie(_authorizationCookieName)

’ Convert the cookie to an httpCookie

passThruCookie.Domain = responseCookie.Domain

passThruCookie.Value = responseCookie.Value

passThruCookie.Expires = responseCookie.Expires

passThruCookie.Path = responseCookie.Path

_AuthorizationCookie = passThruCookie

retCode = True

End If

'–Clean Up

res.Close()

Catch ex As Exception

’ Handle Error

Finally

AuthenticateUserAgainstMaster = retCode

End Try

End Function

End Class

Thanks for help

Lisa

Subject: Windows VB.NET application to execute a Domino URL (2nd Post)

Sounds like you have a readers field in the document that only allow admins to read. If you give the user Anonymous Editor, or Reader if they are only going to read from the database, access and the admin role it should still work it that’s the problem.