<%Using Html.BeginForm("Print", "Secure", Nothing, FormMethod.Post , New With {.target="_blank"})%>
Turns out that the form tag always included the target attribute, you just need to instruct the BeginForm helper to use it.
<%Using Html.BeginForm("Print", "Secure", Nothing, FormMethod.Post , New With {.target="_blank"})%>
Dim startTime As DateTime = DateTime.Now()
Dim recordsToProcess As Integer = 0
Dim recordsProcessed As Integer = 0
Dim recordsErrored As Integer = 0
recordsToProcess = dataSetWithRecords.Tables(0).Rows.Count
For Each drCurrentRecord As DataRow In dataSetWithRecords.Tables(0).Rows
'do processing here
Try
'execute task
.
.
.
'update success counter
recordsProcessed += 1
Catch ex as Exception
'handle error state
'update error counter
recordsErrored += 1
End Try
Next
Dim endTime As DateTime = DateTime.Now
Dim timeElapsedSeconds As Double = DateDiff(DateInterval.Second, startTime, endTime)
Dim timeElapsedSpan As TimeSpan = New TimeSpan(0, 0, timeElapsedseconds)
Dim sbSummary As New System.Text.StringBuilder
sbSummary.AppendLine("Agent Results:")
sbSummary.AppendFormat("Total records to process:{0}", recordsToProcess.ToString)
sbSummary.AppendLine()
sbSummary.AppendFormat("Records processed Successfully: {0}",recordsProcessed.ToString)
sbSummary.AppendLine()
sbSummary.AppendFormat("Records with errors: {0}", recordsErrored.ToString)
sbSummary.AppendLine()
sbSummary.AppendFormat("Processing Time: {0} Hours, {1} Minutes, {2} Seconds", timeElapsedSpan.Hours, timeElapsedSpan.Minutes, timeElapsedSpan.Seconds)
sbSummary.AppendLine()
LogMessage(sbSummary.ToString)
Dim trackId As String = "D" + Left(Guid.NewGuid.ToString.Replace("-", ""), 9)
HttpContext.Current.Cache.Insert(curCCR.TrackingId.ToString, curCCR, Nothing, System.DateTime.MaxValue, New System.TimeSpan(0, 30, 0))
<webmethod()> _
Public Function RetrieveHistoryForTrackingId(ByVal trackingId As String) As BusinessObject
Dim newObj As BusinessObject = HttpContext.Current.Cache(trackingId)
Return newObj
End Function
Dim response As webservices.Response = ws.SendRequest(encoded)
If response.Errors.Length = 0 Then
Dim obj As webservices.BusinessObject = Nothing
Dim timeout As DateTime = DateAdd(DateInterval.Minute, 2, Date.Now)
While DateDiff(DateInterval.Second, Date.Now, timeout) >= 0
obj = ws.RetrieveHistoryForTrackingId(trackId)
'if Object has data, exit loop
If Not obj Is Nothing Then Exit While
System.Threading.Thread.Sleep(30000)
End While
If Not obj Is Nothing Then
grdHistory.DataSource = obj.HistoryItems
grdHistory.DataBind()
Else
'no responses
lblStatus.Text = "History records have not yet been received. If you would like to check for results again, please use the link below. History records are held for 30 minutes upon receipt."
txtTrackingId.Text = trackId
End If
Else
lblStatus.Text = "Error submitting request: " + response.Errors(0).ToString
End If
Private Sub invokeWebServiceActivity1_Invoked(ByVal sender As System.Object, ByVal e As System.Workflow.Activities.InvokeWebServiceEventArgs)
End Sub
Private Sub invokeWebServiceActivity1_Invoking(ByVal sender As System.Object, ByVal e As System.Workflow.Activities.InvokeWebServiceEventArgs)
End Sub
Private Sub invokeWebServiceActivity1_Invoking(ByVal sender As System.Object, ByVal e As System.Workflow.Activities.InvokeWebServiceEventArgs)
e.WebServiceProxy.Credentials = New System.Net.NetworkCredential("username", "password", "domain")
End Sub