Published on: 01/30/14 6:35 PM
Category:Code SPA Tags: Durandal JS, jqueryHello all,
In last post we have seen what can be possibilities for single page application here
Today I have face very complex problem. Actually its a little one, but because of less documentation on the internet and no reference it was quite difficult to solve. But after some study of framework, I got the solution
I have created some demos with Durandal framework. Its having some different folder structure and some different configuration but with demo or starter kit of its, you will get to know its work with HTML and js very will but my requirement was, it should run with aspx page too. Means I want aspx page as view for that I could not find solution on internet and api documentation of the framework too.
But I have find solution
What I done is, I have made some changes in the framework itself It having one js file named viewEngine.js. The viewEngine module provides information to the view Locator module which is used to locate the view’s source file. The viewEngine also transforms a view id into a view instance.
It just parse the HTML and if it found any other file, then it use parseHTML function of jquery
but It take default extension as .html so I have change the default extension to .aspx so it will only render aspx pages.
Note: If you are following started kit of Durandal, and made changes as I mention above then you also need to change the file extension of shell.html to shell.aspx because by above changes it will just render aspx files not html files as view
Enjoy, Have a great day ahead
Hi Prasad
Thanks for your post above. I am curious does this really work? what i mean is will the server process the ASPX page properly? I have a similar problem where i would like to use Durandal however i have 1 ASPX user control that is quite complex that i would like to keep – the question is will the control work properly on the aspx page? so if i route to my aspx page will the server process the aspx part of the control?
Thanks
Peter
Yes Peter, It works properly I have created one project with this changes.
so suppose we build everything in this framework then it means entire source code is available to be downloaded by anyone? is not that really great for security??..
Hi Amit.
Actually Duradal is Javascript framework. So in javascript, everything is visible. So every client side code is visible to user not server side code. Also you can implement XSS and XST to add security to your project.