1

Application problem error:1 Asp.net/VB

Тема: Application problem error:1 Asp.net/VB

I need your advice about the following problems I faced with some applications that was developed on wialon Local using wialon API/ASP.net-VB
when running any application from outside our local network, it generates (error:1), but when the same application is being used from inside our premises, it works properly.

Application problem error:1 Asp.net/VB
Application problem error:1 Asp.net/VB

please see the following CODE :

 

  Public wialonurl As String = "http://---------/wialon/ajax.html?svc="

    Public Function getvehicle() As String
        Dim sid As String = Request.QueryString("sid")
        Dim objText As String
        Dim result As String = ""
        Dim url = wialonurl & "core/search_items&params={spec:{itemsType:avl_unit,propName:sys_id,propValueMask:*,sortType:*,propType:*},force:1,flags:0x00000001,from:0,to:0}&sid=" & sid
        Dim req = DirectCast(WebRequest.Create(url), HttpWebRequest)
        Using reader = New StreamReader(req.GetResponse().GetResponseStream())
            objText = reader.ReadToEnd()
        End Using
        If objText.Contains("error") Then
            result = objText
        Else
            Dim json As JObject = DirectCast(JObject.Parse(objText), JObject)
            Dim arrText As String = json("items").ToString()
            result = arrText
        End If
        Return result
    End Function


    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        TextBox1.Text = getvehicle()
    End Sub
2

Application problem error:1 Asp.net/VB

Re: Application problem error:1 Asp.net/VB

Hello

Session id (sid) generates for IP and if you'll try to use it from another one - you'll get error.
I think in your local network all client has same external IP and everything works, for outside IP changes and app stop working.

Where you get sid that you pass to your app?

3

Application problem error:1 Asp.net/VB

Re: Application problem error:1 Asp.net/VB

I get session id from url as shown below

Dim sid As String = Request.QueryString("sid")
4

Application problem error:1 Asp.net/VB

Re: Application problem error:1 Asp.net/VB

mabed
Yes i see, but what page open your app? Who generate this sid?
You open your application from Wialon Local interface or ...?

5

Application problem error:1 Asp.net/VB

Re: Application problem error:1 Asp.net/VB

Yes
Application problem error:1 Asp.net/VB

Application problem error:1 Asp.net/VB

6

Application problem error:1 Asp.net/VB

Re: Application problem error:1 Asp.net/VB

In this case you logic wouldn't work, because browser IP differs from your server IP and they cant use same SID.

To solve this problem you can use Authorize Hash instead of Active SID in app settings.
Ih your app you'll get authHash parameter that you can use in core/use_auth_hash request to get sid.

Also i recommend to use core/logout when you dont need session anymore to avoid limitations issues

7

Application problem error:1 Asp.net/VB

Re: Application problem error:1 Asp.net/VB

Thank you smile