///////////////////////////////////////////////////////////////////////// // DEVICE-INDEPENDENT POSTBACK ///////////////////////////////////////////////////////////////////////// // The functionality required here is to trap and handle // postback events at the page level (delegating to the adapter), // rather than expecting a control to handle it. // This has to be done in DeterminePostBackMode, because there isn't // anything else overrideable. protected override NameValueCollection DeterminePostBackMode() { // Ignore the transfer case. if (Context.Handler != this) { return(null); } // Let the specific adapter to manipulate the base collection if // necessary. NameValueCollection collection = Adapter.DeterminePostBackMode(Context.Request, postEventSourceID, postEventArgumentID, base.DeterminePostBackMode()); // Get hidden variables out of the collection. if (collection != null) { // If the page was posted due to a redirect started by calling // RedirectToMobilePage, then ignore the postback. For details, // see RedirectToMobilePage method elsewhere in this class. if (Page.Request.QueryString[MobileRedirect.QueryStringVariable] == MobileRedirect.QueryStringValue) { collection = null; } else { int count = collection.Count; for (int i = 0; i < count; i++) { String key = collection.GetKey(i); if (key.StartsWith(HiddenVariablePrefix)) { HiddenVariables[key.Substring(HiddenVariablePrefix.Length)] = collection[i]; } } String eventSource = collection[postEventSourceID]; if (eventSource != null) { // Page level event RaisePagePostBackEvent(eventSource, collection[postEventArgumentID]); _eventSource = eventSource; } } } _requestValueCollection = collection; // If doing a postback, don't allow redirections. if (collection != null) { MobileRedirect.DisallowRedirection(Context); } return(collection); }
public void RedirectToMobilePage(String url, bool endResponse) { bool queryStringWritten = url.IndexOf("?") != -1 ? true : false; if (Adapter.PersistCookielessData) { IDictionary dictionary = Adapter.CookielessDataDictionary; if (dictionary != null) { foreach (String name in dictionary.Keys) { if (queryStringWritten) { url = String.Concat(url, "&"); } else { url = String.Concat(url, "?"); queryStringWritten = true; } url = String.Concat(url, name + "=" + dictionary[name]); } } } MobileRedirect.RedirectToUrl(Context, url, endResponse); }