// Writes the href value for RenderBeginLink, depending on whether the target is a new form on the
        // current page or a standard url (e.g., a new page).
        private void RenderHrefValue(XhtmlMobileTextWriter writer, String target)
        {
            bool appendCookielessDataDictionary = PageAdapter.PersistCookielessData &&
                                                  !target.StartsWith("http:", StringComparison.Ordinal) &&
                                                  !target.StartsWith("https:", StringComparison.Ordinal);
            bool queryStringWritten = false;

            // ASURT 144021
            if (target == null || target.Length == 0)
            {
                target = Page.Response.ApplyAppPathModifier(Control.TemplateSourceDirectory);
            }



            if (target.StartsWith(Constants.FormIDPrefix, StringComparison.Ordinal))
            {
                RenderFormNavigationHrefValue(writer, target);
                appendCookielessDataDictionary = false;
            }
            else
            {
                // For page adapter Control = null.
                if (Control != null)
                {
                    target = Control.ResolveUrl(target);
                }

                // ASURT 147179
                if ((String)Device["requiresAbsolutePostbackUrl"] == "true" &&
                    IsRelativeUrl(target))
                {
                    String templateSourceDirectory = Page.TemplateSourceDirectory;
                    String prefix = writer.EncodeUrlInternal(Page.Response.ApplyAppPathModifier(Page.TemplateSourceDirectory));
                    if (prefix[prefix.Length - 1] != '/')
                    {
                        prefix = prefix + '/';
                    }
                    target = prefix + target;
                }

                if ((String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false")
                {
                    writer.WriteEncodedText(target);
                }
                else
                {
                    writer.Write(target);
                }
                queryStringWritten = target.IndexOf('?') != -1;
            }

            if (appendCookielessDataDictionary)
            {
                RenderCookielessDataDictionaryInQueryString(writer, queryStringWritten);
            }
        }
        // Writes the href value for RenderBeginLink, depending on whether the target is a new form on the 
        // current page or a standard url (e.g., a new page).
        private void RenderHrefValue (XhtmlMobileTextWriter writer, String target) {
            bool appendCookielessDataDictionary = PageAdapter.PersistCookielessData  && 
                !target.StartsWith("http:", StringComparison.Ordinal) && 
                !target.StartsWith("https:", StringComparison.Ordinal);
            bool queryStringWritten = false;

            // ASURT 144021
            if (target == null || target.Length == 0) {
                target = Page.Response.ApplyAppPathModifier(Control.TemplateSourceDirectory);
            }



            if (target.StartsWith(Constants.FormIDPrefix, StringComparison.Ordinal)) {
                RenderFormNavigationHrefValue (writer, target);
                appendCookielessDataDictionary = false;
            }
            else {
                // For page adapter Control = null.
                if (Control != null) {
                    target = Control.ResolveUrl(target);
                }
                
                // ASURT 147179
                if ((String)Device["requiresAbsolutePostbackUrl"] == "true"
                    && IsRelativeUrl(target)) {
                    String templateSourceDirectory = Page.TemplateSourceDirectory;
                    String prefix = writer.EncodeUrlInternal(Page.Response.ApplyAppPathModifier(Page.TemplateSourceDirectory));
                    if (prefix[prefix.Length - 1] != '/') {
                        prefix = prefix + '/';
                    }
                    target = prefix + target;
                }

                if ((String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false") {
                    writer.WriteEncodedText (target);
                }
                else {
                    writer.Write (target);                
                }
                queryStringWritten = target.IndexOf ('?') != -1;
            }

            if (appendCookielessDataDictionary) {
                RenderCookielessDataDictionaryInQueryString (writer, queryStringWritten);
            }
        }