[mapguide-users] Losing Session ID

Jackie Ng jackie.ng at aecsystems.com.au
Tue Apr 10 09:13:01 EDT 2007


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


Micha Lehmann wrote:
> 
> Hi Jackie,
> 
> Thanks for your effort, maybe you could give me an example for this way ?
> 
> Micha
> 
> ps: sorry, i sent you this via email, just a mistake
> 
> 
> 
> Jackie Ng wrote:
>> 
>> Hi There,
>> 
>> I noticed that there are two <form> tags in that markup, one being
>> server-side and the other is not. 
>> 
>> You could be losing your session id because it is written to the non
>> server-side form. If you write the session id to both <form> tags, then
>> GetParameters() should retain that session id over multiple postbacks.
>> 
>> Hope that helps.
>> 
>> - Jackie
>> 
>> 
>> Micha Lehmann wrote:
>>> 
>>> Hi there,
>>> 
>>> i´m going to develop a streetname/housenumber search
>>> 
>>> i created a master detail drop down list in visual studio 2005 express 
>>> edition, right now i´m able to choose a ID from these list, the lists 
>>> are auto post back enabled, so the site is refreshing each time you 
>>> change a name and/or a number...and then i always loose my session ID
>>> 
>>> the same result if i´m starting a *.aspx from the task pane frame
>>> 
>>> whats causes this?
>>> 
>>> Thank you
>>> 
>>> Michael
>>> 
>>> 
>>> <%@ 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>
>>>         <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>      
>>>     
>>>     <%
>>> // Display a form prompting the user to enter the beginning
>>> // portion of the parcel owners name. Submitting this form
>>> // replaces the content of this frame with a list of matching
>>> // results.
>>> 
>>> // If a Search has already been run and the results are still
>>> // visible (e.g. if the ParcelMarker layer is visible), then
>>> // display an button allowing the user to clear the previous
>>> // search results as well.
>>> 
>>> 
>>> 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%>"
>>> /></p>
>>>     <p><input type="submit" value="Suche" /></p>
>>>     </form>
>>>     
>>>     <%           
>>>         Response.Write(mgSessionId);  
>>>         
>>>      %>    
>>>     
>>>     
>>> </body>
>>> </html>
>>> 
>>> 
>> 
>> 
> 
> 

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



More information about the mapguide-users mailing list