Prevent redirect to site.mobile.master - webforms

When I run the web form template of Visual Studio 2013 on a mobile phone the master page is redirected to Site.Mobile.master by default. Is there any way to prevent this and how???
THANKS

you can fool the application adding the code below in your web.config inside
<system.web>
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<filter>isMobileDevice=false</filter>
</browserCaps>
</system.web>
The code should be placed within the <system.web> tag. Your web.config file may already contain the tag, so can be placed in the existing one.

Related

Using HttpHandler (ashx) to serve images

I'm trying to implement an httphandler to serve images. I've seen plenty of examples and the process seems simple enough. However, it seems that my image tag
<img src="ImageHandler.ashx?picture=moon.jpg" />
persists in interpreting the call to the handler as a straight URL. ImageHandler.ashx is in the App_Code folder. I figure the problem is in registering the handler. Here's my current web.config entry (I've tried lots of them, includeing *.jpg as the path.):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="ImageHandler" path="*.ashx" verb="*" type="ImageHandler" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" />
resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
What am I missing?!
Thanks!
Visual Studio decided that the ashx file needed to be TWO files. I knew that was going on. However, what I didn't know (until I tried copying the files into and out of the App_Code folder) was that having the ashx file in the app root and the ashx.vb file in the App_Code folder would make the handler work - without needing to register it in the web.config file. Never seen anything like it.

Telerik Controls Not working on IIS 7.5

I am developing a telerik Asp.net Ajax project using .net 4.5 and vs 2012. My development environment is working great however when I deploy my app on IIS 7.5 my default.aspx screen that contains 3 radcomboboxes and a radgrid is not working at all. When I say its not working the comboboxes are not dropping down and the radgrid controls are not responding. However when I replace one of the comboboxes with a Microsoft Dropdown I get the expected control behavior. I'am not sure what is causing this.Any ideas or suggestion will be highly appreciated.
These are my handlers in web.config.
<handlers>
<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource"/>
<add name="Telerik.ReportViewer.axd_*" path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=6.1.12.823, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" preCondition="integratedMode"/>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</handlers>
WebResource.axd file which contains all the resources pertaining to Telerik is not getting loaded on runtime. That's the reason you see an unexpected behavior. Make sure that following httphandler exist in your web config file.
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
Refer to the following link for more help.
http://www.telerik.com/help/aspnet-ajax/introduction-web-resources-troubleshooting.html
I would also advice that if you are not using authentication in your app and if there are lines related to it exist in your web config, get rid of them.
I have managed to resolve this by removing the property UpdatePanelsRenderMode = "Inline" from inside my RadAjaxManager. This property if is set to inline places the contents inside html spans and for some reason the WS did not like it.

Why Do we need to change the handlers in web.config while using the telerik controls

I have a question, as on why do we need to add handelers to web.config file while working with telerik controls
what is the significance of the following code?
<system.web>
<httpHandlers>
<add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
</httpHandlers>
</system.web>
and another question is that in the section why do we remove the asset handler first and then immediately add it again?
<handlers>
<remove name="asset" />
<add name="asset" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
</handlers>
.axd files are HTTP handler files and Telerik probably use them for managing their scripts and assets such as images and stylesheets for their skins.
This handler has to be registered in the web.config so it's executed when the browser requests this file and to ensure it's directed to the approperate HTTP handler. Telerik controls behind the scenes can then safely assume the assets are available.
If you view the generate html source of your application you'll probably see references to asset.axd?blah==3dfijefi if you view the contents of this file you'll see exactly what's going on (although probably minified).
As for why they suggest removing and adding again I suspect it's to stop parent web.config files that may reference older versions etc... ? Just a safety net really.

MVC3/Razor: cshtml.Execute()': no suitable method found to override

I am trying to convert an MVC2 site to MVC3 using RazorViewEngine.
I used this tool to upgrade my project and the Telerik converter tool to convert my .aspx views to Razor. The Telerik tool put an #inherits line at the top of my layouts (inherting from ViewMasterPage).
When I tried to run a page that used one of these layouts, I got the error:
...cshtml.Execute(): no suitable method found to override
I removed the #inherits tag and it started to work for my home page. However, I continued to get this error for another page using the same layout. And now, after moving some things around to deal with an Areas issue, I'm back to getting this error for all my pages (the ones I can get to, anyway).
I have tried closing Visual Studio, deleting temporary files, etc.
Figured it out - the following section needs to be in the web.config for razor - I had it in the web.configs in the Views directories, but not in the root web.config:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
There could be a few things going on here. Make sure you are following these guidelines
you don't have #inherits directives in your views. unless you are using a custom view page base class they are unnecessary. For strongly-typed views you should use the #model directive to specify the model type. For weekly-typed views you don't need anything.
don't mix razor views with aspx master pages (or aspx pages with razor layouts), as they don't work together easily. This includes checking all of your action methods where you have code like return View("ViewName", "MasterName") since that might also cause conflicting templatign technologies to be used.
If you still have a backup of your MVC2 project I would try using the tool Microsoft released on MSDN for this. See this link for more information. Also Scott Guthrie wrote something about it in his blog posts when MVC3 was released, you can read the article here.
I'm afraid I can't give you an direct solution to this. But sounds like an bug or problem in the conversion software from telerik you used.

Why does my WebForms report viewer not display icon resources?

I am trying to integrate the SSRS WebForms report viewer into an ASP.NET MVC2 app. The viewer comes up, but none of the javascript is evaluated. It looks like all of the javascript and icon resources come out of calls to the "Reserved.ReportViewerWebControl.axd" pseudo url. My MVC app is ignoring calls to .axd URI's, but I get tons of javascript errors in the page that's hosting the report viewer. Is there something else that I need to do to get the calls to the .axd handler to work? That particular handler is in my web.config and it looks like this:
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
For what it's worth, our SSRS is SQL2005, but I am using the SQL2008 report viewer. Do I have to use the SQL2005 reportviewer web control?
Thanks,
Matthew
Turns out I didn't set up the .axd HttpHandler in the correct place in the web.config. I had modified the IIS6 section, but not the IIS7 section. Works like a champ now.

Resources