PDA

View Full Version : [CLOSED] Running an application with a relative address



RCN
Apr 18, 2013, 5:16 PM
I would like to know how to config an application to run with a relative address.

6064

On the following example, the click fails when the application is running under a relative address.



<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<script type="text/javascript">
var click = function () {

Ext.net.DirectMethod.request({
url: "Example/PersistirRegistro",
cleanRequest: true,
success: function (result) {
alert('Sucess');
},
failure: function () {
alert('Failure');
}
});
}
</script>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Button Text="click me" runat="server">
<Listeners>
<Click Handler="click();" />
</Listeners>
</ext:Button>
</body>
</html>




public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}

public AjaxResult PersistirRegistro()
{
return new AjaxResult();
}
}


Any ideas to overcome this issue?

Vladimir
Apr 18, 2013, 5:24 PM
You can use <%= %> blocks


url: '<%= Url.Action("Example/PersistirRegistro") %>',


or try this


url: Ext.net.ResourceMgr.resolveUrl("~/Example/PersistirRegistro"),

RCN
Apr 18, 2013, 5:36 PM
Thank you Vladmir. it worked like a charm.

Please mark this thread as closed.