Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

How to redirect to a .asp page upon submit from Silverl... RSS

4 replies

Last post Nov 08, 2010 05:39 PM by danyeung

(0)
  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    How to redirect to a .asp page upon submit from Silverlight?

    Oct 31, 2010 11:29 PM | LINK

    The first block below is the XMAL in Silverlight.  When the Submit button is clicked, it suppose to redirect to an .asp page with some hidden fields.  How can I accomplish the second block of asp code in Silverlight?  Thanks.

     <Canvas>
    
                        <!-- Layer 1/<Group>/<Path> -->
                        <Path Fill="#ffffffff" Data="F1 M 374.110,416.974 C 368.478,416.974 363.910,421.541 363.910,427.174 L 363.910,440.774 C 363.910,446.407 368.478,450.974 374.110,450.974 L 591.710,450.974 L 591.710,416.974 L 374.110,416.974 Z"/>
    
                        <!-- Layer 1/<Group>/<Path> -->
                        <Path Data="F1 M 660.640,416.974 L 591.710,416.974 L 591.710,450.974 L 660.640,450.974 C 666.273,450.974 670.840,446.407 670.840,440.774 L 670.840,427.174 C 670.840,421.541 666.273,416.974 660.640,416.974 Z">
                            <Path.Fill>
                                <LinearGradientBrush MappingMode="Absolute" StartPoint="417.900,318.977" EndPoint="417.900,288.329">
                                    <LinearGradientBrush.GradientStops>
                                        <GradientStop Offset="0.00" Color="#fff09024"/>
                                        <GradientStop Offset="1.00" Color="#fff15b26"/>
                                    </LinearGradientBrush.GradientStops>
                                    <LinearGradientBrush.Transform>
                                        <MatrixTransform Matrix="1.000,0.000,-0.000,-1.000,213.375,738.500" />
                                    </LinearGradientBrush.Transform>
                                </LinearGradientBrush>
                            </Path.Fill>
                        </Path>
    
                        <!-- Layer 1/<Group>/sign up for our newsletter -->
                        <TextBox x:Name="EmailAddress" Foreground="#ff083950" BorderThickness="0" Canvas.Left="372.910" Canvas.Top="424.470" FontSize="10" FontFamily="Myriad Pro" TextWrapping="NoWrap" Width="210" Text=""></TextBox>
    
                        <!-- Layer 1/<Group>/SUBMIT -->
                        <Button Canvas.Left="599.910" Canvas.Top="424.470" FontSize="15" FontFamily="Verdana" BorderThickness="0" FontWeight="Bold" Foreground="#FFFFFF" Click="Button_Click" Content="Submit">
                            <Button.Template>
                                <ControlTemplate TargetType="Button">
                                    <Border x:Name="Border" Background="#FFF09024" BorderThickness="0">
                                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                                    </Border>
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
    
                    </Canvas>


    <form action="_abc.asp" method="POST"> 
        <input type="hidden" name="subject" value="Submission" /> 
        <input type="hidden" name="redirect" value="thankyou.html" />
        Email: <input type="text" name="email" />
        <input type="submit" name="submit" value="submit"/>
        <input type="hidden" name="alpha" value="alpha"/>
        <input type="hidden" name="hourly" value="hourly"/>
        <input type="hidden" name="html" value="html"/>
    </form>
    


  • prolay

    prolay

    Contributor

    2290 Points

    415 Posts

    Re: How to redirect to a .asp page upon submit from Silverlight?

    Nov 01, 2010 06:14 AM | LINK

    Hi,

    If i understand you correctly. You can navigate to a aspx page using

    HtmlPage.Window.Navigate(new Uri("http://YourDomain/Pag1.axpx"));

    You can pass parameters to the aspx page with the help of QueryStrings.

     

    Regards

  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Re: Re: How to redirect to a .asp page upon submit from Silverlight?

    Nov 02, 2010 03:07 PM | LINK

    Thank you.

    Danyeung

  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Re: Re: Re: How to redirect to a .asp page upon submit from Silverlight?

    Nov 04, 2010 09:14 PM | LINK

    I just want to make sure that it would be like

    HtmlPage.Window.Navigate(new Uri("_abc.asp?subject=Submission&redirect=thankyou.html&alpha=alpha&hourly=hourly&html=html));

    Is it correct?

  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Re: Re: Re: How to redirect to a .asp page upon submit from Silverlight?

    Nov 08, 2010 05:39 PM | LINK

    I got the following error. In HtmlPage.Window.Navigate(new Uri("_abc.asp?subject=Submission&redirect=thankyou.html&alpha=alpha&hourly=hourly&html=html));, it has to be a full URL like HtmlPage.Window.Navigate(new Uri("http://www.domain/_abc.asp?subject=Submission&redirect=thankyou.html&alpha=alpha&hourly=hourly&html=html));

    Is there a work around without the http://www.domain/?  Thanks.

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727;
    .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C;
    .NET4.0E; BO1IE8_v1;ENUS)
    Timestamp: Mon, 8 Nov 2010 04:22:40 UTC


    Message: Unhandled Error in Silverlight Application Invalid URI: The format of the URI could not be determined.  
    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
       at System.Uri..ctor(String uriString)
      
    at SkateContract.MainPage.Button_Click(Object sender, RoutedEventArgs e)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
    Line: 1
    Char: 1
    Code: 0