Saurabh,
Here is a VS2013 version that uses .NET 4.5.1 (since you are one windows 8). You will need to change the wsdl url in the index.html from
ws.wsdl ="http://yourserver/ArcGIS_Security/Service.wsdl";
to
ws.wsdl ="http://yourserver/ArcGIS_Security/ValidateUser.svc?wsdl";
As far as your question about returning the logged in user name. That is done in the Flex Viewer Files\src\index.html included in the zip file I linked in the previous post.
Hello Robert
I have applied the code on IIS 8.5 ( gisbeta - /devsummit2012/ ). I got some error of duplicate records ( on line 14,16,17,18,19 of web.config) which i commented ( as i did in previous code ) . After that i got directory browsing error which i resolved again. But now im getting this error. I have changed the line of username and password which u have mentioned earlier .
thanks and regards
Saurabh
Robert
I have used the different one . I will try with the one you have provided ( devsummit 2012).
Just wanted to know ..
Can We some how pass the Username to my Main app to show which user have logged in ..something like" Welcome Username" . I have seen that some one has posted the same query but i guess it was not answered .
Regards
The ability to have a certain config.xml based on the viewer that has logged in is part of the ArcGISSecurity web service found in this link:
https://community.esri.com/message/182812#182812
I am not sure which link you used to get your webservice for user validation but the one above uses a list of users names and passwords and the specific config to return once the user has successfully logged in.
Hello everyone
I have applied the above code to get a login screen up and running
Thanks for this great work. But still i am searching how to load different config file according to role of the user
Thanks and regards
Hi Forums,
One time i need to create simple login mechanism for flex viewer 3.6, i create it like this
-----
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:viewer="com.esri.viewer.*"
xmlns:managers="com.esri.viewer.managers.*"
pageTitle="ArcGIS Viewer for Flex">
<fx:Style source="defaults.css"/>
<fx:Metadata>
[ResourceBundle("ViewerStrings")]
</fx:Metadata>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.PopUpManager;
protected function button1_clickHandler(event:MouseEvent):void
{
if(text1.text == "P4ssw0rd")
Alert.show("Login success!");
viewerContainer.visible= true;
}
else
Alert.show("Login failed!");
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Form id="form1" x="3" y="1" width="226" height="64">
<s:TextInput id="text1" width="200" height="20" displayAsPassword="true" enabled="true"
prompt="Password"/>
<s:Button left="60" width="100" height="20" label="Enter" click="button1_clickHandler(event)"/>
</s:Form>
<viewer:ViewerContainer id="viewerContainer" visible="false" x="0" y="0">
<viewer:configManager>
<managers:ConfigManager id="configManager"/>
</viewer:configManager>
<viewer:dataManager>
<managers:DataManager id="dataManager"/>
</viewer:dataManager>
<viewer:mapManager>
<managers:MapManager id="mapManager"/>
</viewer:mapManager>
<viewer:uiManager>
<managers:UIManager id="uiManager"/>
</viewer:uiManager>
<viewer:widgetManager>
<managers:WidgetManager id="widgetManager"/>
</viewer:widgetManager>
</viewer:ViewerContainer>
</s:Application>
---
type 'P4ssw0rd' for password, and press enter
works fine for me,
Regards - Tommy
Thanks a lot for the reply
I have updated by link in post 108 so that it links to the correct location in GeoNet.
Hello We cannot access the link
Just posted some code for a Flexviewer login screen. I hope somebody can get some use from this.http://www.arcgis.com/home/item.html?id=baebcaf317994d63902bc9735c0657e0
Have you modified the ViewerContainer.mxml ?http://forums.arcgis.com/threads/25899-Login-Screen-for-the-Flexviewer?p=139178&viewfull=1#post139178
I checked and the entire ArcGIS_Security folder has read/write extended to IUSRS account.
No, it doesn't need a Windows account at all. Are you sure the web server service account has read privileges for the users.xml file?
Robert,Wondering if this you know if the login code works with v3.0 Flexviewer? I Replaced localhost with server name and added folder to root making it an application, but get internal database error. I added a random user and password to the users.xml, but it does not work. Does it actually have to be a local user? We are on Windows Server 2012.Derek
Steph, I can not spend a lot of time on IIS questions here or ASP.net web service configuration as that is not what this forum is for, but What user name you use for the web service is a internal IT question. In my case I use a specific user that was developed just for running web services. The web service should be set to use windows authentication and ASP.NET Impersonation.
Steph, The first thing I would check is this url "http://servername/ArcGIS_Security2/Service.wsdl". I use a reverse proxy in my web server configuration so I create a Service.wsdl file manually and most asp.net web services do not create this file. See if changing to http://servername/ArcGIS_Security2/Service.asmx?wsdl helps with that error. Also in the web.config file of the web service make sure you changed this line to valid values:<identity impersonate="true" userName="yourusername" password="yourpassword"/>
<identity impersonate="true" userName="yourusername" password="yourpassword"/>
Steph, The name of the config.xml is returned from the ASP.net webservice when a user logs in and that is then used by the index.mxml file to load the proper config.xml in the viewer. I have no time to walk anyone through the code or steps but the necessary code and changes to the viewer are available at this url: http://gis.calhouncounty.org/devsummit2012
Thanks, I will have a look at it and see what I can do! Much appreciated 🙂
Steph, The name of the config.xml is returned from the ASP.net webservice when a user logs in and that is then used by the index.mxml file to load the proper config.xml in the viewer. I have no time to walk anyone through the code or steps but the necessary code and changes to the viewer are available at this url:http://gis.calhouncounty.org/devsummit2012
Greg, Yes changing it to visible.Login="false" does work as a workaround but If you are like me and want to load a specific Config.xml file based on the user that logs in then that is not a feasible workaround.
Hi, I have managed to create an ASP.NET wrapper application for my flex viewer application. Users and user access to different basemaps is built into SQL tables in the GIS database, there is a helpdesk function where 1st line suppport team can edit/create users and manage their access to basemaps without developer intervention. Passwords are encrypted by the .net app before being written to the database. This was designed for intranet use only.Once a user is verified, they are presented with a choice of basemaps to load for the flexviewer app (they can only choose one, but may be entitled to see several). The map url they choose is then passed from the .net application to the flex viewer by using URL params. The flex viewer is actually embedded in an aspx page that sits within the .NET application project. There are also some code changes you need to make to the flex viewer out-of-the-box code to enable it to read the map url passed from the .net application. There is plenty of scope to take what I have created and extend it / edit it to do other user specific processing in the flex application (ie load certain config files for particular users).If anyone is interested I can make the .NET code available together with the stored procedures for creating the authorisation tables in SQLServer, but I would suggest that non-technical users and people with zero .NET/ SQL experience would maybe find this a little beyond their capability and should consult their development team. There is probably a much neater way to do the user authentication by using the built in .NET API's for user/role authorisation. However in our case we needed to be able to manage users who are outside the company and have no windows domain accounts with us, but are able to access our intranet and this was the path of least resistance.Also please note, to make the application work properly, there are changes that need to be made at the flex end in order for the URL params passed from .NET wrapper to be read. There is definitely scope for this code to be played with to enable different configs to be loaded for different users or any other user specific actions to be executed in the flex application based on URL parameter info passed through.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.