Select to view content in your preferred language

Edit widget+token

806
1
07-24-2012 10:29 AM
anjelinaponker
Emerging Contributor
Hi
I,m using secured map service and flex3. I add token to my config.xml but when I run Edit widget the login page appear and if user dont know the user and pass he should cancel login page 8 times, after that he can edit layer!!!!!!!!!!!
What should I do for solving this problem?
Does Edit widget has token support or no?
Regards
A.ponker
Tags (2)
0 Kudos
1 Reply
SarthakDatt
Frequent Contributor
Hey Angelina,

This issue is similar to the issue in this thread: http://forums.arcgis.com/threads/61828-Opening-Edit-Widget-causes-secure-service-challenge?p=213638#..., the out-of-the-box Edit Widget is not passing the token when creating feature layers on the fly.

For workaround, you can update the code as follows:

// get corresponding featurelayers
var jsonTask:JSONTask = new JSONTask;
var urlVars:URLVariables = new URLVariables();
urlVars.f = "json";
// Line 401
jsonTask.proxyURL = layer.proxyURL;    
jsonTask.token = layer.token;
jsonTask.url = featureServiceURL;  
jsonTask.execute(urlVars, new AsyncResponder(jsonTask_resultHandler, jsonTask_faultHandler, { layer: layer, count: index }));

and 

fLayerObject = candidateFeatureLayers[index1];
var featureLayer:FeatureLayer = new FeatureLayer;
// Line 461
featureLayer.proxyURL = arcGISDynamicMapServiceLayer.proxyURL;
featureLayer.token = arcGISDynamicMapServiceLayer.token;
featureLayer.url = featureServiceURL + "/" + fLayerObject.id;    
updateFeatureLayerMinMaxScale(featureLayer, fLayerObject.id, copyLayerInfos);
featureLayer.addEventListener(LayerEvent.LOAD, featureLayerLoadHandler);
featureLayer.addEventListener(LayerEvent.LOAD_ERROR, featureLayerLoadErrorHandler);
0 Kudos