MVC 1.0 FormCollection wiped out by running SSRS report - model-view-controller

I have an MVC 1.0 app with a form that works just fine.
The app also launches an SSRS using the URL ReportServer interface (**Not the Webform ReportViewer Control!). This also works just fine.
But if I export the generated SSRS report (say to .pdf), and then return to the MVC application, no form will work. By "not work" I mean that on the Post action, the form collection is not returned.
I'm completely lost as to what could be causing this behavior. Any ideas? Thanks in advance.

Figured it out. One site was NTML authenticated, and the other was not. I had assumed with IE8 and tab-session states that the NTML - non-NTML IE optimization interplay no longer applies. But this experience proves it does, at least on XP and Vista.
So the solution is to either hack the client registery (I've never thought this approach really practical) or in my case, use 2 sub-domains. In the latter case, it's important to know that the IE authentication optimization uses the full URL. So suba.mydomain.com and subb.mydomain.com will each be treated as a unique site by the IE authentication optimization, and hence not lead to the sequential site authentication dependancy problem.
This KB is relevant: http://support.microsoft.com/kb/251404

Related

ASP.NET MVC AntiForgeryToken and Caching

I am currently working on an ASP.NET MVC project and came upon an error that seemed peculiar.
In the ASP.NET MVC Templates forms always get an AntiForgeryToken (thus leading me to believe that this is a best practice). However AntiForgeryTokens don't seem to work well with caching.
For example when I open a site with a form including an AntiForgeryToken and I duplicate the browser window both windows have the exact same AntiForgeryToken leading to an exception when posting the form. This problem does not exist when caching is disabled (via ActionFilter NoCache, see Disable browser cache for entire ASP.NET website).
So I guess my question is: Is this supposed to be that way? Is there any other way besides disabling the cache to tackle the problem?
Especially the fact that the default ASP.NET MVC templates contain AntiForgeryTokens but don't disable the cache (and therefore are open to the error described above) makes me wonder.
Thanks in advance!
This is the expected behavior. Caching nicely caches the answer, including the value of the AntiForgeryToken. Disable caching on forms, and in particular on pages that use AntiForgeryToken. If you think about this further, if you're in a data-entry app, do you want to cache your data-entry forms? Probably not. However you do want to cache heavy reports -- even if it's just micro-caching -- a second or two.

Blank page on Azure

I have an application running in Azure (trial account). So far so good, everything has been nice, except for a long deploy times (10-15 minutes).
I've done a deploy recently and got a lot of weird bugs I cannot trace. For example, if I log in and thus a cookie is created (I use FormsAuthentication) all I get from the application is a blank page, as in, absolutely nothing is sent to the browser. The application works fine in the ASP.NET Web Dev Server, IIS Express, even the Azure Emulator!
What could be the issue? Searching the web hasn't been much help, with only a couple of unrelated issues.
I tried logging into the site (if I correctly understood from one if the comments, the url is versulo.com) and I didn't get any blank page with 404 status code.
However, there is another problem I spotted. Your site seems to be implementing caching inappropriately. The main page, the one from which you trigger the login and which is dynamic in nature contains an Expires header set at 5 minutes after the pages first load. That means that each call or redirect to that page within 5 minutes since it was first loaded, will be served from the browser's cache.
Because of that, after I login into your application I am redirected back to the home page which looks like I am not logged in. If I force a F5 refresh on the browser, then the page will indeed show me as logged in.
If instead of a refresh I try to login again (which is what I did in my first trials, since it looked like the login didn't work in the first time), I am getting an error page with the following message:
Sorry, there has been an error on the server.
500
The page looks like an application error page and even if it displays the 500 number, it is actually served with an HTTP 200.
So, while I am not 100% sure if this is also the cause of the problem described by you, you should remove the Expires headers from the dynamic pages your application is serving.
This can be because you're combining Forms Authentication with multiple instances. Are you using multiple instances? If that's the case, could you:
Try to change it to 1 instance. Does this fix the issue?
Try to make the following change to the web.config (configure machineKey): http://msdn.microsoft.com/en-us/library/ff649308.aspx
some partial views are not rendered at all;
Do you mean some pages are working fine, but others are not? It would be better if you can point out a pattern on what’s working and what’s not? For now, please make sure all referenced assemblies (except for default .NET assemblies and Windows Azure runtime) have Copy Local set to true. For example, MVC assemblies are considered as extensions to .NET, so please set Copy Local to true. In addition, you can also try to use Fiddler to monitor the requests to see what’s returned from the server.
Best Regards,
Ming Xu.
Could you provide a link to the application, or perhaps some source code?
When you say 'blank page', what is actually returned, a 404 / 500?
Have you inspected the IIS logs, or added some trace information to your code?
Have you tried accessing the service using it's ip address rather than domain name?

WIF - A potentially dangerous Request.Form value was detected

I get the Error:
A potentially dangerous Request.Form value was detected from the
client (wresult="
I've used WIF in my .NET 4.0 website, and use
<httpRuntime requestValidationType="Namespace.FederatedRequestValidator"/>
which allows me to deal with the validation, and have no issues.
I now want to use WIF in my .NET 3.5 application in VS 2008, but the above config is not valid, and .NET 3.5 doesn't seem to have System.Web.Util.FederatedRequestValidator
How can I get around this error, preferable without turning validation off.
If I need to turn validation off, whats the best way to achieve this in VS 2008 .NET 3.5?
I ended up creating a sign in .aspx page which is a 'middle man' between the replying party and the STS. Call that page, and pull any extra parameters from the URL and then redirect to the STS with the sign in page .aspx as a return url.
I then made it that that page, and only that page ignored validation, which isn't a problem since that page does nothing but call and return from the STS.

C# Performance Issue

I am facing a very strange situation and don't know how to solve it...Please help me solve the issue...
I am working on a web site where a research page is created to measure the performance of tasks done in the web site. It is one type of report page which checks for different conditions into the database tables, retrieves the information and send an email to the administrator. The page runs in every hour that is 24 times per day.
Now what the issue is: The web site works correctly however when the research page runs the other pages of the web site do not work correctly. That is say for example I am on the Page1 and at the same time the research page start running. Now at this time - when research page is running - if I click on the link of Page2, the Page2 will not get displayed until research page finishes its working. Can anyone tell what could be the issue for this behavior?
Here are some more information regarding the issue:
The web site is in Visual Studio 2008 (C#) and SOL Server 2008 is
used
The SOL query is too complex for research page however, I have made
all the optimization which are possible.
There are two connection strings (with different user for same
database) used in the web site. One for the Research page and second
for all the other pages in the site
Please help me find out the issue... Thanks in advance....
This may be due to mishandling of the Thread within you website. Have you tried it by Threads and Building Asynchronous Handlers in Your Server-Side Web Code
Just check out this might help you with :
http://msdn.microsoft.com/en-us/library/ms741870.aspx
msdn.microsoft.com/en-us/library/ms741870.aspx
http://www.albahari.com/threading/part3.aspx
And also do take care of releasing the necessary resources which might be locks up the Table, even though the Thread function gets over.

OWC does not work with IE8

I have a web page that is generated with Access 2003 and uses Office Web Components. It worked fine with IE6 and IE7 but does not work anymore with IE8.
Here are more details. I create an MSODSC component and a WSH object to get my ConnectionString in the registry. Then the Dropdown Lists are fed by a request to the database.
It works perfect with IE6 and IE7, works locally with IE8 but if the page is served by IIS to IE8, the drop down lists are empty.
Can anyone help me ?
Thanks
Mactov
It was just a security issue. I had put my site in the confidence zone (according to the error message). I transfered it into intranet zone and it works perfect.
Here is how I solved - actually almost solved it. The help message was explaining me to put my pages into the "confidence zone" (I don't the actual name in english) but it was not working anyways. I then took my pages to the "local intranet" zone and it worked good. It is just a matter of security.
May that help.
Mactov

Resources