Asp.net MVC application displaying html content in browser - asp.net-mvc

I am facing a very strange problem with my web application developed in ASP.Net MVC 3. Time to time it directly displays HTML source in browser. This issue comes randomly with different urls.
After I checked the content type returned using Google chrome debugger I found content type being returned form server is txt/vnd.wap.wml
I haven't written anything which takes care of wap or mobile based client.
URL from which I am getting issue right now is : live url.
Can someone suggest why this is happening and how to fix it.

Related

troubleshoot asp.net web app on iOS

I have a web app with asp.net mvc 5 on running on iis 7.5. I have a photo upload page that I made with DropZone (a javascript ajax upload plugin). In my asp.net controller during certain errors, I return an httpstatuscode of 500 with a status description with a descriptive error. DropZone then displays this descriptive error. Everything works as it should on desktop devices, however when used on an iOS device it displays a generic "Internal Server Error" message.
I'm lost at how to troubleshoot this issue. I've placed javascript alerts throughout my javascript code to try and figure out what the issue is but that didn't reveal anything helpful. I've tried using the MIHTool ipad app and the HttpWatchBasic ipad app to try and set breakpoints but that was not helpful either.
Is there a way to remotely debug an asp.net web app from an iPad? (I have visual studio 2013 premium) Or does anyone have any ideas what may be causing a different status code to be sent?
UPDATE: It appears that iOS devices ignore any custom xhr.statusText and uses the standard default statusText (i.e. code 500 is Internal Server Error). As a work around (which I hate doing, but since this is primarily for use on company iPads I didn't have much choice) I've returned a different 500 class code for each possible exception and then in the javascript code check the status code and assign my own custom error message in the javascript code.
Quickest and easiest way to see the actual exception is to turn off custom errors in your Web.config - you'll then be able to view the actual stacktrace on the iPad.
If you'd like to be able to debug the exception, you should be able to trigger it by accessing the site from the iPad by hitting your windows development machine while running in the debugger. You'll need to configure IIS express to allow remote connections (editing application host.config), adding a urlacl, and opening the Windows firewall if necessary. There are numerous guides in setting this up online.
If you want to actually debug the JS in mobile Safari, this is possible from the Mac version of Safari - see http://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787 for details.

ActiveX cannot screen capture a page that is hosted on the same server

I have an app that takes a screenshot of web pages and creates a resized image. The app is basically loading a web page that calls an ActiveX to load a web page using IE resources and take the screenshot. This app has been running on a Windows Server 2003 without any problems for a couple of years.
But now that I have upgraded the server to Windows Server 2008, the screenshot action is timing out. From tests I can see that it successfully takes a screenshot of any web page hosted on the Internet... except pages hosted on the same server.
Whenever it tries to capture a page loaded on a site hosted on the same server as the app, it times out. ESC is disabled and it seems that all other permissions are ok, ie: it works for remote pages but for home pages.
Any ideas as to what can be causing this and how to fix it?
After further testing I have narrowed down the reason for failure being due to the page being popluated from a MS-SQL database record on the same server as the one taking the screenshot. The same page generated on a remote server captures ok. I have further established that the error is not peculiar to the ACASystems DLL because it also affects another DLL for creating MHT files from web pages. This DLL (Chilkat.MHT) also uses IE to load and assemble the web page on the fly and then saves it as a.mht file.
So the problem is more related to IE assembling web pages from MS-SQL while running ActiveX. But to resolve this enigma?
Maybe a routing issue (DNS/hostfile..) ? Does the page loads on local session with IE ?
There is no solution for this without editing the ActiveX code. Since the DLLs in question are third party resources, such editing is not possible.
After testing 3 different ActiveX that load a web page that either take a screenshot or save as .mht, it was found that they all failed when loading a page that was querying SQL on the same server. After contacting the 3 DLL developers we were informed by all of them that their ActiveX has no impact on MS-SQL.
Unfortunately, our tests tell us otherwise. At this stage we are left guessing however this article about in-process vs out-process execution may be related.
The workaround for us to solve this problem was to assemble the page to be captured from request queries passed to the page rather than populate from SQL queries. This alternate works perfectly.

Asp.Net-MVC application dying

I have a strange issue with an Asp.NET MVC application.
Using Asp.NET MVC 3 Preview 1 on IIS 7.5 - Integrated
After building the application everything runs fine. Then after some random amount of time (or sometimes after updating a view or js file) the application dies.
Meaning, requesting the root page, I get the 403 error and requesting any other page I get a 404 error.
After a rebuild everything works fine again for a little while until it dies again.
I am seeing this on two different development machines. Also, I have another application which is very similar (MVC 3, IIS etc) on both dev machines and this one runs without problem. I have inspected the config files in detail and cannot see anything of notable difference.
Does anyone know what could cause an application to die or where to look for further information? (I can still access elmah.axd though no information is there).
There's not much to go on here, but the 403 and 404 are clues that at least ASP.NET routing is not working; 403 is coming back because the web server thinks you want to do a directory browse, 404 because your request doesn't have a valid corresponding resource.
Since you are using the new version of MVC, I would suspect the issue may lye there. When you get the error condition, can you browse to a regular .aspx page? Does it execute server side code correctly?
You have the site hosted in IIS 7.5, not just the built in Visual Studio web server, right? Is it possible to turn on monitoring/event logging to see if IIS is taking a hit?
I apologize for not having any actual answer, sounds like you have a tough issue to debug.
Good Luck!

Asp.net MVC page is giving Mime type warnings for image files

While I do not see any functionally or jquery UI elements affected by this, but when I access my asp.net mvc web page the chrome developer console is logged with a bunch of error messages like so:
Resource interpreted as image but transferred with MIME type application/octet-stream.
All of the warnings are for jquery UI images (though I don't have any custom images on there so I don't know if it's jquery UI only). All the jquery images still load correctly.
Does anyone have any insight on why this is happening?
Are you running your site from Visual Studio's built-in web server? Apparently, you don't have much control over the MIME types in that environment (see this). I was seeing the same behavior and was starting to stress about it before finally realizing that I wasn't even looking at the IIS-hosted application.

Asp.Net MVC and Report Viewer Control

I have an Asp.Net MVC page that links out to a Asp.net web form with a report viewer control on it. The web form opens in a new window, and displays a report properly when clicking on the link on my MVC page. However when I close the my broswer window while the report is processing, and try to open it again, the page hangs and eventually gives me a page can not be displayed error.
Thoughts?
Initial thoughts from me are;
1) Not closing objects correctly on errors which might happen when browser windows are closed unexpectadly.
2) Report still running and not allowing another instance. easy to prove. when you get the error, close the window and click the report again. if you get your report then this may be a candidate.
3) Caching issues. try setting IE to refresh on every visit.
I think 1 or 2 are likely as I've seen this before on one of my applications where processing was interuppted.

Resources