I am a .NET developer and I code web apps against databases. I have been able to move my GIS .NET development to the Esri JS API except for the proxy information, but is there a secure way to use JavaScript for interaction with just a database?
Ideally Esri will make the new data layer editable and that would take all limitations away as long as I could relate data geographically. That will take care of some, but probably not all. Any ideas? Or should I stick with .NET for talking to the server securely?
Thanks.
Solved! Go to Solution.
It looks like this is just for the Esri REST API. I have some non-spatial data in a DB2 database that I am trying to evaluate if it can be edited through web services. It looks like I would need to consume non-geospatial data through .NET web services.
Try this tutorial for regular DB work.
Build RESTful API's with ASP.NET Web API | The ASP.NET Site
or this:
EF Database First with ASP.NET MVC: Creating the Web Application and Data Models | The ASP.NET Site
Looks like I might need to learn AngularJS, ASP.NET MVC and maybe C#; still program in VB.NET. It looks like we could serve web services on the client using this though, but the rest services still need to be built with .NET. This provides me with a start. Time to start self-training.
you can also use classic ASP to create a RESTish url. I just query a DB and spit out JSON manually. when you go to the URL for this script you get a JSON string that you can grab using AJAX in JavaScript from the client side.
set myconn_ = server.createobject("adodb.connection")
connection_ = "Provider=sqloledb; Data Source=xxxx; Initial Catalog=xxx;User Id=xxx; Password=xxx;Network Library=DBMSSOCN"
myconn_.open (connection_)
set result_ = server.createobject("adodb.recordset")
sql = "Select distinct Division, projectname, project_status, objectid from xxx.projects"
set result_ = myconn_.execute(sql)
Response.ContentType = "application/json"
response.write("[")
while not result_.EOF
response.write("{""division"":""" & result_("Division")&""",""objectid"":"""& result_("objectid") &""",""name"":"""& result_("ProjectName") &""",""pid"":"""& result_("Project_Status") &"""},")
result_.movenext()
wend
response.write(" {""division"":"" " & 9 &""",""objectid"":"""& 9 &" "",""name"":"""& 9 &" "",""status"":"""& 9 &"""}]")
result_.close
myconn_.close
set result_ = Nothing
set myconn_ = Nothing
response.end
REST would have a url like someserver/product/1
or someserver/products/delete/5
The ASP solution requires a url like someserver/products.asp and someserver/products/delete.asp
If it's ASP, I would rather use ASP.NET. I was just looking for a way to create regular HTML pages.
I've used Classic ASMX services with ScriptServices to create JSON and XML services to be consumed by AJAX web site with many different client side Javascript Libraries; Dojo, ExtJs, JQuery, etc. I like the classic ASMX services because they are fairly simple, to the point and easily customizable. You have full access to ASP.Net Security objects within the ASMX. I don't have a link to any website or blog with really good examples but if you Google you should find plenty of information.
I could slam together some example code if you desire.