none
Providing navigation URL at run time. RRS feed

  • Question

  •  

    Hi,

    For a web application for every action configured we need to give a navigation URL. Is there any way I can give the navigation URL programmatically.

    I have a legacy adapter for this application and I am overiding the DoAction method. Whenever a particular action (say Action1) of this application is called, I need to load a page, whose URL will be passed as the action data.

     

     

    Currently I am trying to use something like this:

    public override bool DoAction(Action action, RequestActionEventArgs args)

    {

    this.Browser.Url = new Uri("http://localhost/Page1.aspx");

    this.Browser.Update();

    }

     

     

    My aim is to reload the application with the page http://localhost/Page1.aspx but somehow it is working. Any help???

    Monday, March 10, 2008 10:08 AM

All replies

  • DoAction is processing the request prior to the URL ever being navigated to, which is why browser.update() is not working for you Wink


    The way to do this is 2 fold ( as with all things )
    You can either update the Action Object’s URL and Parameters with your updated values and call the base DoAction method, or you can call browser.Navigate which will short circuit the remainder of the process.


    If you use the second method you need to return false from the DoAction Call to prevent CCF from doing the Next step Navigation again.


    Here is an example adapter that is reformatting a request for default and handling an action to send a search request to Live.com.
    The URL configured in CCF for the Nav Action is http://www.live.com

     

    Code Snippet

    using System;

    using System.Collections.Generic;

    using System.Text;

    using Microsoft.Ccf.Csr;

    using Microsoft.Ccf.Csr.Browser;

     

    namespace LiveSearch

    {

    /// <summary>

    /// Live Search Adapter

    /// </summary>

    public class LiveSearchAdapter : WebApplicationAdapter

    {

    public LiveSearchAdapter()

    : base()

    {

    }

     

    public override bool DoAction(HostedWebApplication.WebAction action, ref string data)

    {

    // Clean off the append of the _CCF Data Object

    if (data.Equals("<root><ApplicationData></ApplicationData></root>", StringComparison.CurrentCultureIgnoreCase))

    return false;

    // Handle a Search request

    if (action.Name.Equals("Nav", StringComparison.CurrentCultureIgnoreCase))

    {

    data = data.Replace("<root>", "").Replace("</root>", "" ); // Clean up the Autoappended XML

    // Navigate to the Search Componet of Live and pass in what to search for.

    browser.Navigate(string.Format("{0}{1}" , action.Url , string.Format("?q={0}&go=Search&mkt=en-us&scope=&FORM=LIVSOP", data)));

    return false;

    }

    return base.DoAction(action, ref data);

    }

    }

    }

     

    Hope it helps

    MattB-MSFT

    Friday, March 14, 2008 11:39 PM
    Moderator