C# - MVC Route Based On Web Browser / Device Like IPhone
May 27, 2010
Is it possible, from within ASP.NET MVC, to route to different controllers or actions based on the accessing device/browser? I'm thinking of setting up alternative actions and views for some parts of my website in case it is accessed from the iPhone, to optimize display and functionality of it. I don't want to create a completely separate project for the iPhone though as the majority of the site is fine on any device.
View 2 Replies
Similar Messages:
May 7, 2010
I have an asp.net C# website. Because of iPhone doesn't support flash i want to change a theme of my site on page load or init if user using it. Could any one show me (code in c#) how to determine that user is browsing my website using iPhone or iPad, not a blackberry, or android etc.
View 2 Replies
Dec 16, 2010
I'm just starting to learn the basics of ASP.NET and have encountered a problem I don't know how to solve. I'm used to PHP and if I want a different css based on the device (Android or iPhone) used to browse my website i would do something like this:
<?php
#Check device used
$agent = $_SERVER['HTTP_USER_AGENT'];
if( strstr($agent, "Android") or strstr($agent, "iPhone") )
{
echo(" <link rel="stylesheet" type="text/css" media="screen" href="handheld.css" />
");
}
else
{
?>
<?php } ?>
But how is this done in asp.net? I have no clue.
View 1 Replies
Jan 29, 2010
Nexus One is not currently supported by the Mobile Device Browser File, which leads to the Nexus One being identified as a non mobile device.
I know the user agent, and the capabilities are pretty similar to other Android terminals. With this information, how do I patch the MDBF to have the N1 be recognized as a mobile device?
View 3 Replies
Mar 1, 2010
I am using both the Mobile Device Browser File and a custom .browser file.
In the custom .browser file, there are several ControlAdapters registered. I would like to specify in my custom .browser file to use different ControlAdapters if the detected device is mobile (provided the Mobile Device Browser File lists it as mobile). How do I do that in my custom .browser file? I do not want to modify the Mobile Device Browser File.I am using something like this, but it is not working
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu"[code].....
View 1 Replies
Jan 27, 2011
Since the mobile device browser file is no longer support, what is an alternative to it that requires minimum code changes?
View 2 Replies
Dec 22, 2010
I making web application for iphone user. I have HTML table structure inside asp.net panel and i have set panel's scrollbar property to vertical. It works fine in all the browsers but not working in iphone browser.
View 1 Replies
Sep 22, 2010
I am working on creating an iphone application which logins to we website and retrieves a table, and displays the content within the app. To view the table a Login is required. It seems the site is using Form-Baseds Authentication. WebSite's Login Screen So How do I pass the login ID and pass from xcode to the to the site and retain the information so the user only needs to login once.
View 1 Replies
Aug 11, 2010
My Client wants a native iPhone App that displays their mobile site optimized for iPhone developed using asp.net and ComponentOnes Studio for iPhone. i was planning to use a PhoneGap app which calls an external URL using JavaScript and do it after showing the splash screen. but according to phoneGap FAQ its most likely to apple to reject an app that loads external URL ? just need somebody to clear me on the whole process. isnt it possible to create an app like that ? i've seen various iPhone apps that do this (eg: cydia).
View 2 Replies
Aug 18, 2010
I need to create a web page where the user can select from a variety of categories via a dropdown list, then enter a search term into a textbox to provide a search term. The category is going to dictate which controller to use, and the search term will be a query parameter for the List action of each controller.
What I can't figure out is how to dynamically create the route based on the users selection. How do I get the values selected from the dropdownlist and textbox into Url.RouteUrl?
View 2 Replies
Jul 19, 2010
I have 2 forms, one is filled out when a quote is supplied to a customer, if this quote is succesful a project is created and added to the database. On my form I have 2 buttons, one to simply submit the quote information to the database and I would like the second to, when clicked submit the information to the database and then use this information to fill out some of the fields on the Projects form. I have thought about doing this 2 ways:
I read you could use session variables to store the information, or since the data is already in the database, would it be posssible, that if the user has been directed to the projects page from the enquiries page that it fills in the information into the projects form?
View 3 Replies
Mar 13, 2011
I tried to mix asp.net 4 webfrom and ASp.Net MVC 3. I add required lines in webconfig, but I've issues implementing route in global.asax
Currently I use several routes for webfroms. routs template are like below
routes.MapPageRoute("Node", _
"article/sport/{nID}/", _
"~/article/articleview.aspx")
I encounter error, when I add below lines to global.asax
routes.MapRoute( _
"Defaultss", _
"{controller}/{action}/{id}", _
New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional} _
)
I want to know how could I mix ASp.Net MVC routes with webforms routes.
View 3 Replies
Mar 9, 2010
when i run the app i got this error
A route named 'Admin_default' is already in the route collection. Route names must be unique.
Parameter name: name
this is my AdminAreaRegistration
[Code]....
View 2 Replies
Mar 18, 2011
Does anyone know of a way to embed a web browser within a web page, e.g. through a Java applet or similar mechanism? I have reviewed the discussion on various solutions for embedding a browser in a Java application. However, this will not work for our web-based tool, which is built on an asp.net framework. Using a Java applet is our current idea, but if you have other suggestions to address this issue
This is to be used in a web-based tool that guides middle school, high school, and college students to read websites critically. The tool provides a set of guiding questions and other information along with a data-entry box surrounding the actual 3rd party web-page being viewed. The purpose of our tool is to allow teachers to choose websites for students to view and analyze - or allow students to choose the sites themselves. We (/the tool) do not control what sites or types of media are chosen.
We are currently loading the web-page in an IFrame, but that technique is limited in several ways. It does not provide full control for browser-like features we would like to provide, and is very sensitive to changes in both third party web-sites and to browser versions used by students. The most difficult issue we have pertains to anti-hijacking mechanisms used on the third-party sites. For good reasons, they use mechanisms that make them impossible to load into an iFrame -- that is, when you try to load the page into the iFrame, it will take over the entire browser window. Not only will the page not load WITHIN our frame, it will actually make our application "disappear", thereby making it impossible for students to use these sites within our tool, and potentially also causing students to lose their work.
View 1 Replies
Feb 20, 2010
i would like to have the browse list which does NOT support the .net based created website
View 3 Replies
May 19, 2010
In one online application, like online exam, If two users are on same IP address series then I need to generate questions that are completely different.
I am having no idea what approach should I follow.
View 1 Replies
May 14, 2010
I am developing a small browser based game in asp.net. Think of a game room which has a capaticy of 22 players and players join the room by clicking a button. ( I am saving the number of players in the room in database) I need to call a method when the number of players in the room is 22. The problem is I don't know how to control the number of players in the room. I mean I think like there need to be a bacground code which has to run all the time at the server and that code controls the number and call the function.
View 4 Replies
Sep 24, 2010
I have a url that I want to map routing to:
[URL]
where tabvalue is one of: "personal", "professional", "values" or nothing.
I want to map it to a route like:
Member/Edit/{tab}
But my problem is - I don't know how to specify such constraints. I'm trying this regex:
^[personal|professional|values]{0,1}$
but it only works when I use url
[URL]
[URL]
and doesn't work for
[URL]
how to specify the correct constraint?
P.S. I'm not using MVC, just asp.net WebForms
View 6 Replies
Jul 23, 2010
In Visual Studio 2010, is there a way of changing the Cascading Style sheet on the server-side based on the client browser? I want to create different style sheets for the different browsers (Firefox, Chrome, IE, Opera, Safari etc..) and specify which one to use from the master page.
View 2 Replies
Jul 7, 2010
I have some javascript files for each browser version and for different browsers. I want to include this files in script tag of script manager. Is it will detect these files and load based on browser version? Is there is best way to handle this scenario declaratively in markup insted of codebehind?If not declaratively how in code behind?
View 2 Replies
Apr 5, 2010
I would like to know how a browser based POST request is converted to server side event like button_click.
View 3 Replies
Mar 14, 2011
Was looking at asp.net mvc complex routing for tree path as an example of how to define a custom route handler for my MVC app. Essentially, I want to give the end user ultimate flexibility in defining the URL for any given page, so I provide them with a field in the interface to specify their own custom URL.
My custom route handler is basically a wild-card handler. It will do a lookup and if it finds a match, map it accordingly. However, if no match is found, I want it to fall back and find the next rule that matches in the global.asax. Is that possible? Or do I essentially need to code the mappings that used to exist in my global.asax into my custom route handler?
View 2 Replies
Oct 14, 2010
I know the content palcehlder does not have a size ,I have a masterpage and content page, the master page has a table with a header, content area, and footer, header and footer are fixed size, content area is 100%. As the user sizes the browser the content area grows and shrinks and the footer stays at the
bottom of the browser window - perfect!
Problem: The contentpalceholder does not grow to fill the available content area. Now, the contentplaceholder gets its size from its contents, which in this case is a div holding a silverlight object.I was thinking I could hook the master or child page's re-size event and somehow pass that info onto the SL object, but as it turns out (and I'm surprised I never knew this) there is no aps.net page re-size event! (really?, wow.)
So is there a way to get a SL object hosted on a master page to size itself based on the size of the browser window?Or more generally, a way to size the contents (like a div or panel) of a contentplaceholder based on the browser? on a standard aspx page (not a master page) I CAN get the SL object to size itself based on the broswer, the problem seems to come from the fact that I'm hosting the SL object in a content placeholder.
I guess I could 'unroll' the master page into several standalone pages and have it work, but the menu is on the master page and I'm used to using them, plus it's already done...<sigh>
View 1 Replies
Jun 2, 2010
In my upcoming project, I need to track GPS device attached to vehicles. Is there any way this is possible through PHP or ASP.Net
View 2 Replies
Sep 19, 2010
I have an activex component on my webpage, which is built specifically fro Windows Mobile. This activeX component has a dll which needs to be registered on the device. How Do I register it?
View 1 Replies