开发者

ASP.net for mobile and regular web browsers

I am designing ASP.net Web pages and not sure if this would be the rig开发者_开发技巧ht way to do this. I am designing the web sites that will be accessed from either regular computers or mobile devices (phone). I was thinking to detect at very first page that whether users are coming from mobile browser or regular browser and direct to appropriate pages. So for mobile users, create/display separate UIs (rearrange controls to fit on mobile device) and for regular users, create/display separate UIs. The backend functionalities will be same, but just the UIs. Therefore, in this case I will create two separate projects in same solution, one for mobile UIs, and other one for regular UIs, but same code behinds. Would this be good idea?

Thanks for your help.


In Asp.Net you're really tightly coupled to your views (aspx's). you would have a really hard time If you ever needed to split a large view into several smaller ones for the mobile devices.

I would do one of two things: 1) go with asp.net MVC which is a lot better at this than plain old asp.net (however even here it's not just smooth sailing) example here: http://davidhayden.com/blog/dave/archive/2009/07/29/aspnetmvciphone.aspx

2) have as much as possible of all common logic taken out from the aspx/aspx.cs/master/master.cs files (which is a good idea in any case to enable testing) and just have one directory for each of the frontend options (not reusing the actual aspx's between the two modes)

having two separate projects will probably only cause you headache for deployment, I'd say it's enough to split the modes into their own directoris within the same project.


Well if you create a class on the backend, then you don't have to maintain the working code in two places. You can have your code behind pages reference the class to do all the heavy lifting. You'll still need to maintain two pages the way you are setting it up, but any fixes/updates can be done just once (assuming it's not a UI change).


I think you should look Mobile Web App toolkit. If you use MVC you can make 1 project. I recommend you don´t use mobile controls, they are deprecated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜