ASP .NET + IIS + Crystal Reports + Load report failed - asp.net-mvc-3

I am developping a web application by using the ASP .NET MVC 3 framework.
I have implemented an ASPX page containing a CrystalReportViewer control.
I instantiate a ReportDocument object in my Page_Load event method of my ASPX page.
Then I load a RPT file by using the Load method of my ReportDocument.
My RPT is correctly loaded when I use the VS2010 development web server and I can view it through my viewer.
But the call to the Load method of my ReportDocument raises an exception when I use my IIS 5.1 local web server.
Here are some information about the exception :
Exception Type : CrystalReportsException
Message : Load report failed
StackTrace :
à CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
à CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
à CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
à ASP.aspnetforms_editionresultats_aspx.Page_Load(Object sender, EventArgs e) dans .aspx:ligne 43
à System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
à System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
à System.Web.UI.Control.OnLoad(EventArgs e)
à System.Web.UI.Control.LoadRecursive()
à System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Does someone know why the exception is raised when I use IIS ?

This works for me:
protected void Page_UnLoad(object sender, EventArgs e)
{
this.CrystalReportViewer1.Dispose();
this.CrystalReportViewer1 = null;
// CrystalReportViewer1.Close();
// CrystalReportViewer1.Dispose();
GC.Collect();
}
protected void Button1_Click(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("C:\\inetpub\\wwwroot\\CrystalReportDemo\\CrystalReport.rpt");
CrystalReportViewer1.ReportSource = cryRpt;
CrystalReportViewer1.RefreshReport();
}
}

I faced the same problem and what I did to solve the 'Load Report Failed' problem.
First check whether your report folder exists or .rpt files in your project folder after you publish the asp.net project. I simply placed my whole project folder in the IIS root directory. I am using the my reports in 'Reports' folder that doesn't cause any error.
Then copy C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13” into your project main folder like C:\inetpub\wwwroot\YourProjectFolder\.
Please, comment when this doesn't work.

Related

uploadify flash version - clear queue from .net code

I am trying to clear an uploadify queue from a .net method by this:
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "javascript:$('#" + file_upload_reply.ClientID + "').uploadifyCancel('*')", True)
but it does not clear the queue. Is it possible to clear the queue using the command uploadifyCancel?
Thanks for any pointers.
Library ScriptManager:
Manages ASP.NET AJAX script libraries and script files, partial-page
rendering, and client proxy class generation for Web and application
services.
Use ClientScript:
Such as in Page_Load:
protected void Page_Load(object sender, EventArgs e)
{
ClientScriptManager cs = Page.ClientScript;
if (!cs.IsStartupScriptRegistered("cancel"))
cs.RegisterStartupScript(GetType(), "cancel", "javascript:$('#aa').uploadifyCancel('*')", true);
}

WebClient.DownloadProgressChanged not working?

I am using Windows Phone to download a file with a WebClient. The DownloadProgressChanged event does not work. It fires only once, returning a value of "4923206" for DownloadProgressChangedEventArgs.BytesRecieved. My code is:
private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
WebClient wb = new WebClient();
wb.DownloadProgressChanged += wbchange;
wb.OpenReadAsync(new Uri("http://sohowww.nascom.nasa.gov/data/LATEST/current_eit_304small.gif"));
}
private void wbchange(object sender, DownloadProgressChangedEventArgs e)
{
MessageBox.Show(e.BytesReceived.ToString()); (obviously in the end I will not be showing a message at every change)
}
What is wrong with this?
It's working absolutely fine, it just happens to have downloaded all the bytes on the first DownloadProgressChanged invoke.
If you read the documentation you'll see that this is the expected behaviour.

Not able to insert data into remote mySQL Database using PHP

I am trying to insert data into remote MySQL database using WP7 app but values does not get inserted, PHP file works perfect as my queries are getting inserted into DB using JAVA(Android). As I am new to C# I am facing this challenge.
The code goes like this:-
public MainPage()
{
InitializeComponent();
textBox1.Text = "http://www.abc.com/xyz/user_master.php?Email=abc#xyz.com&Username=abc&Password=xyzz&Phone=98989";
client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
}
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
textBlock2.Text = e.Result;
}
}
private void button1_Click(object sender, RoutedEventArgs e)
{
client.DownloadStringAsync(new Uri(textBox1.Text));
}
Please correct me.
The problem is that you are using "DownloadStringAsync" which sends a GET and so you POST variable is not filled in PHP, you have to use "UploadStringAsync".
For now I can not tell you how the body has to look like... Until now I have used JSON all the time. Would be nice if you could post it here to let me know when you got it ;)
update
Ah, to slow =(
Could you please still post how your message body looks like!

Get response from web browser for windows phone 'mango'

I m my application I want to use Webbrowser which will be using Wifi,after the Webbrower opens the the link (task.URL) ,I want to check what is the response like whether the linked got opened or it failed.How do I do that means get the response ?
WebBrowserTask task = new WebBrowserTask();
task.URL = "https://www.goggle.com/";
task.Show();
kindly help
Thanks.
Usually, to catch this use NavigationFailed event as follow:
void WebPage_Loaded(object sender, RoutedEventArgs e)
{
this.webHome.Navigate(new Uri(www,UriKind.Absolute));
this.webHome.NavigationFailed += webHome_NavigationFailed;
}
void webHome_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e)
{
this.webHome.NavigateToString("No web page available.");
}

SSRS 2005 - http://<servername>/reports error

We have recently configured SQL SERVER 2005 reporting server and it works when I go to http://<servername>/reportserver. But when I want to access http://<servername>/reports, I am getting the error.
"The request failed with HTTP status 400: Bad Request"
After going through few articles online about how to fix it...
I have tried changing some code in the RSWebApplication.config file.
<UI>
<ReportServerUrl>http://<servername>/reportserver</ReportServerUrl>
<ReportServerVirtualDirectory></ReportServerVirtualDirectory>
<ReportBuilderTrustLevel>FullTrust</ReportBuilderTrustLevel>
</UI>
But it did not work. Can anyone please help? Thanks!
here is the log...
System.Net.WebException: The request failed with HTTP status 400: Bad Request.
at Microsoft.SqlServer.ReportingServices2005.RSConnection.GetSecureMethods()
at Microsoft.ReportingServices.UI.Global.RSWebServiceWrapper.GetSecureMethods()
at Microsoft.SqlServer.ReportingServices2005.RSConnection.IsSecureMethod(String methodname)
at Microsoft.SqlServer.ReportingServices2005.RSConnection.ValidateConnection()
at Microsoft.ReportingServices.UI.Global.SecureAllAPI()
at Microsoft.ReportingServices.UI.ReportingPage.EnsureHttpsLevel(HttpsLevel level)
at Microsoft.ReportingServices.UI.ReportingPage.ReportingPage_Init(Object sender, EventArgs args)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Page.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
w3wp!ui!7!9/8/2011-13:58:39:: e ERROR: Exception in ShowErrorPage: System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg) at at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg)
Look like a security issue. Might want to examine this MSDN article there seems to be number of possibilities. Let us know if any of them work.

Resources