Select to view content in your preferred language

Login Screen for the Flexviewer

36993
121
03-15-2011 10:52 AM
andrewj_ca
Frequent Contributor
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
Tags (2)
0 Kudos
121 Replies
StephAllen
Deactivated User
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


Robert,

Thanks again for the files. I managed to get Andrew's original Login to work but I am stuck on this one. I continue to get "Internal Database Error", no matter what I try in either IIS or the index.mxml.

I simplified the index.mxml to only utilize username and password as I didn't need the rest with regards to District, Dates, etc. I am SO CLOSE to getting this launched! Below is the portion where I 'think' is hitting the road-block. If it is something too complex and/or you don't have time, I will have to go another route. I would appreciate your help if you can???

// The functions to connect to the WebService for user validation
protected function submit_clickHandler(event:MouseEvent):void
{
validate_user_proxy(); //use this to call service
}

protected function validate_user_proxy():void
{
var proxyService:String= "validatedUserInfo";
var ws:WebService = new WebService;
ws.wsdl ="http://servername/ArcGIS_Security2/Service.wsdl";
ws.loadWSDL();
ws[proxyService].addEventListener(mx.rpc.events.FaultEvent.FAULT,validationFaultHandler);
ws[proxyService].addEventListener(mx.rpc.events.ResultEvent.RESULT,vsResultHandler);
ws.getOperation(proxyService).send("PrivateWebGIS",userName.text,passWord.text,"username","password","configfile");
}

public function validationFaultHandler(event:mx.rpc.events.FaultEvent):void
{
this.currentState = "Login";
lblStatus.text="Internal database error.";
}

//Set the public vars based on the users choices
public function vsResultHandler(event:mx.rpc.events.ResultEvent):void
{
var configFile:String = event.result as String;
if(configFile != ""){
var outArray:Array = configFile.split(",");
usrConfigfile = outArray[0];
usrName = outArray[1] + " " + outArray[2];
//if(dRangeChk.selected){
//usrBDate = DatePicker1.selectedDate;
//usrEDate = DatePicker2.selectedDate;
//}
//usrDistrict = (DistrictCb.selectedIndex > -1) ? String(DistrictCb.selectedItem) : "None";
//usrCrimeType = (CrimeTypeCb.selectedIndex > -1) ? String(CrimeTypeCb.selectedItem) : "None";
//usrMuni = (MuniCb.selectedIndex > -1) ? String(MuniCb.selectedItem) : "None";
currentState = "Viewer";
}else{
currentState = "Login";
lblStatus.text="Invalid login.";
}
}
]]>
</fx:Script>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
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"/>
0 Kudos
StephAllen
Deactivated User
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"/>


Oh goodness, I didn't even think about that string of code.  Would the 'valid values' be my own personal Windows username and password? Or would this be something else?

That code line was set to impersonate="false" as well.  I would assume, change it to "true"? Also, does that mean I change the IIS Authentication for my site to enable ASP.NET Impersonation from 'disabled' to 'enabled'? I have a feeling I am missing a setting in IIS....
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
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.
0 Kudos
MichaelVolz
Esteemed Contributor
The original post showed a link to download this widget, but it does work.

Broken link - http://www.arcgis.com/home/item.html...2bc9735c0657e0

Does anyone know where I would download the latest compiled login screen widget?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Michael,

   If you read post number 68 it explains that the download is taken down. But post 67 above I attached the code.
0 Kudos
DerekHunter1
Deactivated User
Wondering if this works with v3.0 Flexviewer?  Replaced localhost with server name and added folder to root making it an application, but get internal database error.  I added a user and password, but it does not work.
0 Kudos
DerekHunter1
Deactivated User
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.
0 Kudos
GISDev1
Deactivated User
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

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?
0 Kudos
DerekHunter1
Deactivated User
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?


I checked and the entire ArcGIS_Security folder has read/write extended to IUSRS account.
0 Kudos