Click here to Skip to main content
15,885,952 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is the requirement:

The application is developed in Visual Studio 2015. It has a responsive (bootstrap) UI and is developed in VB.NET. The application has two sets of .aspx pages: one for the main application (works great) and a second for the mobile application (also works great).

When the user logins in using a desktop/tablet, they are correctly redirected to the 'desktop' version of the site including the correct Site.Master and CSS. Clicking the 'ViewSwitcher' on a desktop correctly directs the user to the mobile site SiteMobile.Master and correct CSS. So the desktop works correctly in terms of detecting the device and directing the user. No issue there.

If Request.Browser.IsMobileDevice = True Then
Response.Redirect("~/Mobile/index.aspx")
Else
Response.Redirect("~/AccessSecurity/Dashboard.aspx")
End If

When the user accesses the application using a phone (Chrome, IE, Firefox, etc) the same code directs the user to the mobile version of the application. Great. Again, no issue.

But here is the problem. When the user accesses the application using a mobile and wants to switch to the desktop version, the switcher directs them to the correct page, however the mobile CSS is used (the one referenced in the SiteMobile.Master) and not the one referenced by the Site.Master. No matter what I do, I cannot get the application to use the correct CSS from a phone when switching from Mobile to Desktop view. Here's what I've tried:

- I've tried to force the page.masterfile on pre_init

- I've moved the SiteMobile.Master to a directory called "MobilePages" to get it out of the root directory of the project. The compiler did not like this and wants the file in the root directory of the Visual Studio project:(

- and so on...

So the issue again is only when using a mobile device that switching to desktop view (Site.Master) it retains the mobile css even though the mobile css is not referenced by site.master.

Boy, I really hope I've explained this correctly!

Any insight/experience you've had would be appreciated.

Cory
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900