Developer forum

Forum » CMS - Standard features » The uri string is too long error when testing marketing mail / preview settings

The uri string is too long error when testing marketing mail / preview settings

Peter Leleulya
Peter Leleulya
Reply

Hi guys,

We have an automated mail in the marketing section to send newly added accounts an activation link.
We need the test option in the CMS to work, but it gives us a 'the uri string is too long' error.
It doesn't matter which account I select as test or to whom I send it to.

Is there anything I can do?
All-In-One - Business version 9.9.4


 

Server Error in '/' Application.


Invalid URI: The Uri string is too long.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UriFormatException: Invalid URI: The Uri string is too long.

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:
 

[UriFormatException: Invalid URI: The Uri string is too long.]
   System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) +8516254
   Dynamicweb.Mailing.MessagePreprocessor.MakeAbsolutePath(String url, String domainUrl) +65
   Dynamicweb.Mailing.MessagePreprocessor.ReplaceRelativePaths(String content) +483
   Dynamicweb.Mailing.MessagingHandler.Preview() +341
   Dynamicweb.Admin.OMC.Emails.EditEmail.bnSendTestMail_Click(Object sender, EventArgs e) in E:\agent\_work\150\s\01 - Applications\Dynamicweb.Admin\DW99\Dynamicweb.Admin\Admin\Module\OMC\Emails\EditEmail.aspx.vb:1746
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11762420
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5028

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3701.0


Replies

 
Nicolai Pedersen
Reply

Maybe you have a very long link in the email your are sending?

 
Peter Leleulya
Peter Leleulya
Reply

@nicolai Yes it is quite long .... the path to the page plus username plus guid ... but isn't the max length of a url more than a thousand chars?
With our test domain it is something like below, depending on the username length ... is that a problem?

 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Peter,

I don't think thats the link which is causing problems.
Check if you have any relative links to css files (rel=stylesheet) or images (img src) which are very long.

/Morten

 
Peter Leleulya
Peter Leleulya
Reply

Hi Morten,

 

In the past they worked ...
Here's the HTML of one I could find back.|
I see the link is actually totally different than the one it eventually calls ... if I follow the link.ashx I do get to the website, but I guess that token has expired ...
It is a bare layout, no images etc.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Account activatie e-mail</title>
    <style type="text/css">
        /* Client-specific Styles */
        #outlook a {
            padding: 0;
        }
        /* Force Outlook to provide a "view in browser" menu link. */
        body {
            width: 100% !important;
            -webkit-text-size-adjust: 100%;
            -ms-text-size-adjust: 100%;
            margin: 0;
            padding: 0;
        }
        /* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
        .ExternalClass {
            width: 100%;
        }
        /* Force Hotmail to display emails at full width */
        .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
            line-height: 100%;
        }
        /* Force Hotmail to display normal line spacing.*/
        #backgroundTable {
            margin: 0;
            padding: 0;
            width: 100% !important;
            line-height: 100% !important;
        }

        img {
            outline: none;
            text-decoration: none;
            border: none;
            -ms-interpolation-mode: bicubic;
        }

        a img {
            border: none;
        }

        .image_fix {
            display: block;
        }

        p {
            margin: 0px 0px !important;
        }

        table td {
            border-collapse: collapse;
        }

        table {
            border-collapse: collapse;
            mso-table-lspace: 0pt;
            mso-table-rspace: 0pt;
        }

        a {
            color: #2D7EC3;
            text-decoration: none;
            text-decoration: none !important;
        }
        /*STYLES*/
        table[class=full] {
            width: 100%;
            clear: both;
        }

        /*input the normal mailtemplates the heading datalist a separate table, but this isn't possible when a paragraph with headig and content. Try to style h1 like the system templates.*/
        h1 {
            font-family: Avenir, Calibri Light, Helvetica, arial, sans-serif;
            font-size: 45px;
            font-weight: 100;
            color: #225CA8;
            text-align: center;
            line-height: 30px;
        }

        /*IPAD STYLES*/
        @media only screen and (max-width: 640px) {
            a[href^="tel"], a[href^="sms"] {
                text-decoration: none;
                color: #2D7EC3;
                pointer-events: none;
                cursor: default;
            }

            .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
                text-decoration: default;
                color: #2D7EC3 !important;
                pointer-events: auto;
                cursor: default;
            }

            table[class=devicewidth] {
                width: 440px !important;
                text-align: center !important;
            }

            table[class=devicewidthinner] {
                width: 420px !important;
                text-align: center !important;
            }

            img[class=banner] {
                width: 440px !important;
                height: 220px !important;
            }

            img[class=colimg2] {
                width: 440px !important;
                height: 220px !important;
            }
        }
        /*IPHONE STYLES*/
        @media only screen and (max-width: 480px) {
            a[href^="tel"], a[href^="sms"] {
                text-decoration: none;
                color: #2D7EC3;
                pointer-events: none;
                cursor: default;
            }

            .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
                text-decoration: default;
                color: #2D7EC3 !important;
                pointer-events: auto;
                cursor: default;
            }

            table[class=devicewidth] {
                width: 280px !important;
                text-align: center !important;
            }

            table[class=devicewidthinner] {
                width: 260px !important;
                text-align: center !important;
            }

            img[class=banner] {
                width: 280px !important;
                height: 140px !important;
            }

            img[class=colimg2] {
                width: 280px !important;
                height: 140px !important;
            }

            td[class=mobile-hide] {
                display: none !important;
            }

            td[class="padding-bottom25"] {
                padding-bottom: 25px !important;
            }
        }
    </style>
</head>
<body bgcolor="#FFFFFF"><span style="display: none !important; visibility: hidden; opacity: 0; color: transparent; height: 0; width: 0; mso-hide:all;"></span><img src="https://hoenderdaal-fasteners.acc10.innovadis.com/Admin/Public/EmailMessaging/MessageTracker.ashx?MessageId=1&amp;RecipientId=0" style="position: absolute; height: 1px; width: 1px; top: 0; left: 0" alt="">


<!-- Start of seperator -->
<table width="100%" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="seperator">
    <tbody>
        <tr>
            <td>
                <table width="600" align="center" cellspacing="0" cellpadding="0" border="0" class="devicewidth">
                    <tbody>
                        <tr>
                            <td align="center" height="15" style="font-size:1px; line-height:1px;">&nbsp;</td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
<!-- End of seperator -->
<!-- mail paragraphs -->
<table width="100%" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
    <tbody>
        <tr>
            <td>
                <table width="600" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
                    <tbody>
                        <tr>
                            <td width="100%">

                                <table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
                                    <tbody>
                                        <!-- Spacing -->
                                        <tr>
                                            <td height="20" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;">&nbsp;</td>
                                        </tr>
                                        <!-- Spacing -->
                                        <tr>
                                            <td>
                                                <table width="560" align="center" cellpadding="0" cellspacing="0" border="0" class="devicewidthinner">
                                                    <tbody>
                                                        <!-- content -->
                                                        
<tr>
    <td>
        <table width="100%">
            <tr>
                <td style="font-family: 'Open Sans', sans-serif, Helvetica, arial, sans-serif; font-size: 12px; color: #212529; text-align:left; line-height: 16px;">
                    <h1>Activeer uw account</h1>
                    <p>Beste Innovadis,</p>

<p>Uw Hoenderdaal-Fasteners account aanvraag is verwerkt.<br>
Klik op de link hieronder en volg de stappen.</p>

<p>Heeft u nog vragen? Neem gerust contact met ons op.</p>                
                </td>
            </tr>
                    <tr>
                        <td style="font-family: 'Open Sans', sans-serif, Helvetica, arial, sans-serif; font-size: 12px; color: #212529; text-align:left; line-height: 16px;"><a href="https://hoenderdaal-fasteners.acc10.innovadis.com/link.ashx?id=61&amp;ref=0&amp;Preview=True" target="_blank">Activeer uw account</a></td>
                    </tr>
        </table>
    </td>
</tr>

                                                        <!-- End of content -->
                                                    </tbody>
                                                </table>
                                            </td>
                                        </tr>
                                        <!-- Spacing -->
                                        <tr>
                                            <td height="20" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;">&nbsp;</td>
                                        </tr>
                                        <!-- Spacing -->
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
<!-- end form values -->
<!-- Start of Postfooter -->
<table width="100%" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="postfooter">
    <tbody>
        <tr>
            <td>
                <table width="600" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
                    <tbody>
                        <tr>
                            <td width="100%">
                                <table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
                                    <tbody>
                                        <tr>
                                            <td align="center" valign="middle" style="font-family: " Open="" Sans?,="" sans-serif,="" Helvetica,="" arial,="" sans-serif;="" font-size:="" 14px;color:="" #6C6E70?="" st-content="postfooter">
                                                
                                            </td>
                                        </tr>
                                        <!-- Spacing -->
                                        <tr>
                                            <td width="100%" height="20"></td>
                                        </tr>
                                        <!-- Spacing -->
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
<!-- End of postfooter -->
</body>
</html>

 
Peter Leleulya
Peter Leleulya
Reply

Can it be a sendgrid issue which results into an error in the CMS?

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

I don't think it is a SendGrid issue.

We use regular expressions for parsing the content in order to replace links. There seems to be some invalid markup in the template which might cause issues.

Example:

<td align="center" valign="middle" style="font-family: " Open="" Sans?,="" sans-serif,="" Helvetica,="" arial,="" sans-serif;="" font-size:="" 14px;color:="" #6C6E70?="" st-content="postfooter">

Try to run the html through a validator and fix the errors or remove parts of the markup until it works in order to pinpoint what is causing the error.

/Morten

 
Peter Leleulya
Peter Leleulya
Reply
This post has been marked as an answer

OK ... Mortens help back in 2021 didn't help me ...
I ran in to the same problem again, for another customer ...
This time I found the problem.

The customer had used a base64 image in the rich text editor which generates an enormous url on which the system crashes.

Not sure if this was the cause back then too, but if anyone runs into this error it might be usefull to check the user content for such data.,

Votes for this answer: 1

 

You must be logged in to post in the forum