Page not found with mobile application..

M

mihabib

I have a very simple mobile app that has a text box and object list.
Apps seems to be working OK, however time to time when we try to go
back from details page, it takes to:

The page cannot be found

The page you are looking for might have been removed, had its name
changed, or is temporarily unavailable.

If we start search again, it works OK for few times until dies again.

Following is the code. Any help with be appreciated.

Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient

Partial Class _Default

Inherits System.Web.UI.MobileControls.MobilePage
Private objCnn As New
SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("cnnAMP_DEV"))

'splits the domain\user and returns the user
Private Function RequestLogon_User() As String

Dim LogonId As String() =
Request.ServerVariables("Logon_User").Split("\")
Return LogonId(1)

End Function

'Protected Sub frmMain_Activate(ByVal sender As Object, ByVal e As
System.EventArgs) Handles frmMain.Activate
' lblWelcome.Text = "Welcome user: " + RequestLogon_User()
'End Sub

Private Function PermissionChecking(ByVal LogonID As String) As
Boolean

Dim objCmd As SqlCommand = New SqlCommand
Dim objDR As SqlDataReader
Dim bln As Boolean

If Not (objCnn.State = ConnectionState.Open) Then
objCnn.Open() '--dh

With objCmd
.CommandText = "Donor_Mobile_CheckPermission_ssp"
.Connection = objCnn
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@LogonId", SqlDbType.VarChar, 100).Value
= RequestLogon_User()
End With

objDR =
objCmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
objDR.Read()

With objDR
If .HasRows Then
bln = .GetValue(0)
'bln = .Item(0) Another way of checking the result.
End If

End With

'--dh
objDR.Close()
If Not (objCnn.State = ConnectionState.Closed) Then
objCnn.Close()

Return bln

End Function

Private Sub Donor_Mobile_SearchList_Test_ssp()

Dim objCmd As New SqlCommand
Dim objDA As New SqlDataAdapter
Dim objDS As New DataSet

If Not (objCnn.State = ConnectionState.Open) Then
objCnn.Open()

With objCmd
.CommandText = "Donor_Mobile_SearchList_Test_ssp"
.Connection = objCnn
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@SearchText", SqlDbType.VarChar,
50).Value = txtSearch.Text

objDA.SelectCommand = objCmd
objDA.Fill(objDS, RTrim(txtSearch.Text))
End With

With objListUser
.DataSource = objDS
.TableFields = "LastName;FirstName"
.DataBind()
End With

End Sub

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSearch.Click

If Len(txtSearch.Text) > 0 Then

If PermissionChecking(RequestLogon_User) Then
Donor_Mobile_SearchList_Test_ssp()

Else
Me.ActiveForm = frmDenied

End If
End If

End Sub

Protected Sub frmMain_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles frmMain.Load
lblWelcome.Text = "Welcome user: " + RequestLogon_User()
End Sub
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top