PDA

View Full Version : [CLOSED] Tying a Ext.NET Mobile application to an Ext.NET application



Zdenek
Dec 13, 2016, 7:39 AM
OK
probably there is easier soution to that
So I have one big application written in last years using Ext.net and now I'm starting to write small application usine Ext.Mobile. I would like to have direct calls from mobile application to be called on the bigger one (so technically I want to change url of direct methods. After some fights with CORS it seems to work using simple trick:


function beforeAjaxRequest(con, options, eOpts, params,request) {
request.url = http://kilkelly/bigapplication/WindowsApp/ALAMobile.aspx";
request.headers['X-Ext-Net'] = request.headers['X-Ext-Net-Mobile'];
}

it works fine if I run mobile application using

http://kilkelly/mobileapplication

Hovewer it doe not work when I load mobile application using different cookie domain like

http://localhost/mobileapplication

Direct methods are called hovewer the authentication cookies are not passed


Note that at the end I would like to have following 3 applications
a) separate mobile application
b) mobile and web application on IIS application( this one works fine now)
c) mobile hybryd" application, packed using cordoba or xamarin accessed from localhost/mobileapplication directly on device and connecting to bigapplication on IIS

c) is bit out of scope of this discussion, if I'm sucesfull I will write details to another thread soon

fabricio.murta
Dec 13, 2016, 2:38 PM
Hello @Zdenek!

Can't you bind the domain in the script to a ASP.NET variable? like:



request.url = "<%= HttpContext.Current.Request.Url %>bigapplication/WindowsApp/ALAMobile.aspx";


Or further dig it and build with



string.Format("{0}://{1}{2}",
context.Request.Url.Scheme,
context.Request.Url.Host,
context.Request.Url.Port == 80
? string.Empty
: ":" + context.Request.Url.Port);

[i]Source: Stack Overflow - How can I get the root domain URI in ASP.NET? (http://stackoverflow.com/questions/1214607)

Or maybe you are changing this when you move from domains and it still don't work? Could be a browser limitation regarding XSS or something like it.

fabricio.murta
Jan 03, 2017, 10:37 PM
Hello @Zdenek!

Been some time since we replied your inquire and no feedback so far. Do you still need help with this?

jirihost
Jan 04, 2017, 8:11 AM
Hello

I'm taking Zdenek's tasks. Finally after fighting with cookies I decided to try with extra parameters of (all) direct methods



protected void Application_AuthenticateRequest(Object sender, EventArgs e)
... {
var mobileLoginTicket = Request["mobileLoginTicket"];
// here validate ticket and set user if ticket is valid, tickets are stored in db



and on client



function beforeAjaxRequest(con, options, eOpts, params, request) {
params.mobileLoginTicket = ALAMobile.Win.Application.instance().getLoginTicke t();
request.url = fixedServerUrl()+"/WindowsApp/ALAMobile.aspx"; // fixedServerUrl() returns predefined url to the server
request.headers['X-Ext-Net'] = request.headers['X-Ext-Net-Mobile'];
}



Working for us and is part of the overall mobile solution where result of ext.net mobile is apk file for android

The only problem I'm aware of is that expiration of ticket needs to be managed by us

Not sure if you are interested in details, I'm fine with dsending you complete sample in some way but it's probably above scope of this thread

Thanks
Jiri

fabricio.murta
Jan 05, 2017, 6:15 PM
Hello Jiri, and welcome to Ext.NET forums!

Well, if your solution (or the relevant parts) can be represented in simpler code tags as you posted above, that would be great. I was not seeing much of a possibility of using cookies unless a single sign on (SSO) approach were implemented, which is beyond the scope of Ext.NET anyway (Ext.NET is not responsible for making it possible or impossible, so we can't really help much with that topic).

If you are willing to post a full example or tutorial, we have the forums section Examples and Extras (http://forums.ext.net/forumdisplay.php?12-Examples-and-Extras) which we and the community use to share interesting usage examples of Ext.NET.

Thanks for your feedback, and glad you could find a solution that works for you in that matter!