[mapguide-users] Losing Session ID

Tomas PL photogrametrix at gmail.com
Thu Mar 13 03:07:04 EDT 2008


Hi,
I have the same problem with SESSION ID in PHP. 
Do You know how should it loks like in PHP??

Tom



Chris Gountanis wrote:
> 
> Using the ASP.Net examples from the guide and the ZIP files on OSGEO site
> the code starts like this:
> 
> <%@ Page Language="C#" %>
> <%@ Import Namespace="OSGeo.MapGuide" %>
> <!-- #Include File="common.aspx" -->
> 
> <%
> InitializeWebTier();
> MgUserInformation userInfo = new
> MgUserInformation("Administrator","adminchangeme");
> MgSite site = new MgSite();
> site.Open(userInfo);
> String sessionId = site.CreateSession();
> Session["sessionIdSaved"] = sessionId;
> %>
> 
> Your Session ID: <%= Session["sessionIdSaved "].ToString();%>
> 
> 
> Once you have set the Session variable you can now use the get method
> anywhere it is needed. Keep in mind this is ASP.NET code using C# where
> PHP
> would be a bit different but same concept.
> 
> You can find the ASP.NET and other examples here:
> http://mapguide.osgeo.org/downloads.html
> 
> 
> Documentation here: 
> http://mapguide.osgeo.org/documentation.html
> 
> http://mapguide.osgeo.org/files/mapguide/docs/MgOpenSourceDevGuide.pdf
> 
> 
> Regards,
> Chris
>  
>  
>  
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Micha Lehmann
> Sent: Wednesday, April 11, 2007 2:46 AM
> To: mapguide-users at lists.osgeo.org
> Subject: [mapguide-users] RE: Losing Session ID
> 
> 
> Hi Chris,
> 
> could you give me an example where you would insert these code?
> 
> Thanks, Micha
> 
> 
> 
> Chris Gountanis wrote:
>> 
>> 
>> You could try setting session variables. I also found that in IIS
>> settings
>> you can change the default 20 minute timeout to 60 minutes (or match your
>> MG
>> session) for best results.
>> 
>> 
>> Set: Session["sessionIdSaved"] = sessionId;
>> Get: Session["sessionIdSaved "].ToString();
>> 
>> 
>> 
>> 
>> Chris
>>  
>>  
>>  
>> -----Original Message-----
>> From: mapguide-users-bounces at lists.osgeo.org
>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Micha
>> Lehmann
>> Sent: Tuesday, April 10, 2007 8:57 AM
>> To: mapguide-users at lists.osgeo.org
>> Subject: Re: [mapguide-users] Losing Session ID
>> 
>> 
>> When i´m going to put these line into i get a error:
>> 
>> Compiler Error CS0103 
>> 
>> The name 'mgSessionId ' does not exist in the current context
>> 
>> the code is like this:
>> 
>> <%@ Page Language="C#"  Debug="true" %>
>> <%@ Import Namespace = "OSGeo.MapGuide"%> <!--import der
>> Klassenbibliotheken
>> -->
>> <!-- #Include File="utilityfunctions.aspx -->
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> 
>> <script runat="server"> 
>>     
>>     protected void DropDownList1_SelectedIndexChanged(object sender,
>> EventArgs e)
>>     {
>> 
>>     }    
>>    
>> </script>
>> 
>> <html xmlns="http://www.w3.org/1999/xhtml" >
>> <head runat="server">
>>     <title>Unbenannte Seite</title>
>> 
>> </head>
>> <body>    
>> 
>>     <form id="form1" runat="server">    
>>     <div>
>>     
>>         <input type="hidden" name="SESSION" id="SESSION"
>> value="<%=mgSessionId%>" />
>>         <asp:DropDownList ID="DropDownList1" runat="server"
>> DataSourceID="ObjectDataSource1"
>>             DataTextField="C01" DataValueField="C02"
>> OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
>> AutoPostBack="True">
>>         </asp:DropDownList>
>>         <asp:DropDownList ID="DropDownList2" runat="server"
>> AutoPostBack="True" DataSourceID="ObjectDataSource2"
>>             DataTextField="C12" DataValueField="C01">
>>             <asp:ListItem></asp:ListItem>
>>         </asp:DropDownList>
>>         <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
>> InsertMethod="Insert"
>>             OldValuesParameterFormatString="original_{0}"
>> SelectMethod="GetData"
>> TypeName="DataSet1TableAdapters.ALBSTRASSENTableAdapter">
>>             <InsertParameters>
>>                 <asp:Parameter Name="C01" Type="String" />
>>                 <asp:Parameter Name="C02" Type="String" />
>>             </InsertParameters>
>>         </asp:ObjectDataSource>        
>>         <asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
>> OldValuesParameterFormatString="original_{0}"
>>             SelectMethod="GetDataByC13"
>> TypeName="DataSet2TableAdapters.E1000TableAdapter">
>>             <SelectParameters>
>>                 <asp:ControlParameter ControlID="DropDownList1"
>> Name="C13"
>> PropertyName="SelectedValue"
>>                     Type="String" />
>>             </SelectParameters>
>>         </asp:ObjectDataSource> 
>>       </div>
>>     </form>      
>>     
>>     <%
>> // MG Anmeldegedöns
>> String mgSessionId = GetParameters()["SESSION"];
>> 
>> 
>> 
>> try
>> {
>>     // Initialize the web-tier and connect to the Tux Site using
>>     // the Tux session identifier stored in PHP session state.
>> 
>>     InitializeWebTier();
>> 
>>     MgUserInformation userInfo = new MgUserInformation(mgSessionId);
>>     MgSiteConnection siteConnection = new MgSiteConnection();
>>     siteConnection.Open(userInfo);
>> 
>>     // Create a ResourceService object and use it to open the Map
>>     // object from the sessions repository. Use the Map object to
>>     // determine if the "ParcelMarker" layer is visible.
>> 
>>     MgResourceService resourceService =
>> siteConnection.CreateService(MgServiceType.ResourceService) as
>> MgResourceService;
>>     MgMap map = new MgMap();
>>     map.Open(resourceService, "Siel660355");
>> 
>>     //MgLayer layer = GetLayerByName(map, "ParcelMarker");
>>     //showClearButton = (layer == null) ? false : layer.GetVisible();
>> }
>> catch (MgException mge)
>> {
>>     Response.Write(mge.GetMessage());
>>     Response.Write(mge.GetDetails());
>> }
>> %>
>>    
>>     
>>     <form method="post" action="suche2.aspx">
>>     <p><input name="IDNR" type="text" value="<%=
>> DropDownList2.SelectedValue%>" /></p>
>>     <!-- <p><input name="sessionID" type="text" value="<%= mgSessionId%>"
>> id="Text1" />&nbsp;</p> -->
>>     <p><input type="submit" value="Suche" /></p>
>>     </form>   
>>     
>> </body>
>> </html>
>> 
>> 
>> Maybe i have to write the GetParameters Function in another way?
>> 
>> it´s like this
>> 
>> NameValueCollection GetParameters()
>> {
>>     return Request.HttpMethod == "GET" ? Request.QueryString :
>> Request.Form;
>> }
>> 
>> 
>> 
>> Michael
>> 
>> 
>> 
>> Try putting <input type="hidden" name="SESSION" id="SESSION"
>> value="<%=mgSessionId%>" /> in the server-side form. When your page posts
>> back, it should now be part of the Request.Form collection, which can be
>> retrieved by GetParameters()
>> 
>> - Jackie
>> -- 
>> View this message in context:
>> http://www.nabble.com/Losing-Session-ID-tf3551971s16610.html#a9920249
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> 
>> 
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Losing-Session-ID-tf3551971s16610.html#a9934740
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Losing-Session-ID-tp9916451s16610p16022271.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list