Report is not recognizing the parameter being passed - asp.net

I created a report and deployed on Reporting Services Server. This report is populated using a stored procedure which receives an input parameter: #RecordID.
In the report also, I added a variable with the name RecordID.
In my Visual Studio project, I added Report Viewer control and set the path of the server report. When I open this report on Web Page, it displays error:
Parameter 'RecordID' does not exist on this report
The code in the code-behind file is:
protected void Page_Load(object sender, EventArgs e)
{
Microsoft.Reporting.WebForms.ReportParameter Param = new Microsoft.Reporting.WebForms.ReportParameter("RecordID","3");
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ServerReport.SetParameters(Param);
ReportViewer1.ServerReport.Refresh();
}
Edited
I added a variable using Report Properties in Business Development Studio. Below is the image. This variable is set to receive value of the parameter.

In this you see the steps to add a new parameter and to link it to the Dataset.

Related

IIS Logs do not show the message logged

I am trying to log the entire exception to the IIS log in the following way:
public void OnTransientFaultOccurred(object sender, RetryingEventArgs e)
{
_httpResponse.AppendToLog(string.Format("RetryCount:{0}", e.CurrentRetryCount));
_httpResponse.AppendToLog(string.Format("NextRetryIn:{0}ms", e.Delay.TotalMilliseconds));
_httpResponse.AppendToLog(string.Format("Exception:{0}",e.LastException));
}
But the log only shows '...'.
Is there any limit in terms of how much data can be written to the log ?
One thing to try: Make sure the advanced logging extension is enabled.
As per Append custom value to IIS logs from ASP.NET.

Report not display in report viewer

i try to show ssrsc reports in asp.net web page using report viewer
code
protected void Button1_Click(object sender, EventArgs e)
{
ReportViewer2.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer2.ServerReport.ReportServerUrl = new Uri("http://lenovo-pc/ReportServer");
ReportViewer2.ServerReport.ReportPath = "/Report Project1/Report1";
ReportViewer2.ServerReport.Refresh();
}
where is the probelm... and why report not display?
It tells you the problem in the error message:
Login failed for 'administrator'
The account that you are trying to run the report under does not have access to the database or table that DataSource1 is trying to connect to.
Note that, for security reasons, connection credentials do not propagate when you deploy a report. You may need to set these up for that report on the server that it is deployed to.
Alternatively, you may need to pass the appropriate credentials as part of your code when you run the report.

How to show Crystal Report preview without SQL Server log in authentication?

In asp.net 4.0, when we create report in Crystal Reports using ADO.NET objects, we face a problem that after successfully creating the report preview, the report wants a user id and password for SQL Server. How can I solve this?
When I want to attached ADO.NET object in Crystal Reports it wants an XML file. How can I configure or connect it?
Hey Please refer this code to Resolve your Problem
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
crystalReport.SetDatabaseLogon("username", "password", #"server name", "DB name");
CrystalReportViewer1.ReportSource = crystalReport;
}
hope it will help
If you are getting this after deployee, than you might have reporting server running in same server same port same folder (default port 80, default folder "reports")
to resolve you can do one of
1) Change you name of your reports folder name other than "reports"
or
2) Change the reporting service report manager URL (port or virtual directory name) as in below steps
Step 1 : Type Reporting Service Configuration Manager in Run.
Step 2 : Go to Web Service URL and change TCP Port.
Step 3 : Go to Report Manager URL and go the Advance and Edit the Port Number.
Step 4 : Save it, and all is Done.

Basic facebook web application session info is missing

I made really basic facebook application, which collect permission from user to post data. Some time ago (around New year) it worked fine.
I am using http://facebooktoolkit.codeplex.com, and my code looks like this:
public partial class Facebook : CanvasFBMLBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if(this.Api.Users.HasAppPermission(global::Facebook.Schema.Enums.ExtendedPermissions.publish_stream))
And at this moment I am having exception: parameter uid or session key required
As i understand, I should have some session defined by Facebook and CanvasFBMLBasePage should parse it, and make it possible to use application, but this is not happening.
My application settings (maybe I mis something):
Canvas Callback URL: http://www.domain.com/app/action/facebook.aspx?
Render Method: FBML
Also, I put my IP in server whitelist.
Thanks for help
Have you called the "ConnectToFacebook" method in the api before calling "HasAppPermission"?

How to have http module on fire events only for specific page types [duplicate]

This question already has answers here:
Exclude certain pages from using a HTTPModule
(3 answers)
Closed 7 years ago.
I have an http module on a sharepoint site and this module instantiates a custom class and add it to the session and does other initial things for my site.
However, I'm noticing that the http module is being called for all request types (.aspx, .js, .png, .jpg).
Is there any way to have an http module only be called for .net specific page types?
In IIS you will set up the handler to be associated with your specific extension so the handler will only be applied to that extension. JavaScript files should not be processed.
I would also have a look at this article is you are looking at integrating your module/handler with SharePoint in any way.
While I do like the ease of deployment of this type of http handler (and the fact that you do not have to deploy a web.config entry for the handler), in cases where you may not want to use the _layouts directory OR you want to have a custom file extension, here is an alternative method that works as well (although it does take one manual configuration step in IIS so it may not be suitable for a "No Touch Deployment")
1) Create your http handler as you normally would for an asp.net application. You can add references to the SharePoint DLLs and interact with the object model since you are in the App Pool.
2) Add and entry into your web.config to register your handler and define the extension you are going to use. IE:
3) Define your custom extension in IIS through the IIS > Web SIte Properties > Home Directory > Configuration > Mappings
In this case, we defined a .proxy extension that the handler will pick up. Our handler is a .NET assembly so we need to add the mapping to route .proxy requests to the .net isapi dll (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll).. also, make sure you UNcheck the "
From comments on http://msdn.microsoft.com/en-us/library/bb457204.aspx
I've done a bit more research and it seems there is no way to do what I'm intending.
I will have to check the request type and cancel from there.
Thanks everyone for their answers.
D
You can do this in a very lightweight manner using a HttpModule (before making any calls to the expensive SharePoint object model) by checking the extension in the content of the last Uri.Segments
void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
Uri uri = app.Request.Url;
string lastSegment = uri.Segments[uri.Segments.Length-1];
.. check your extension here an do nothing if it doesn't match.
..
}
We use this in our 'TinyURL' implementation for SharePoint to ensure the performance impact for regular URLs is almost 0.
Here is some simple example how to filter requests by extension... the example below exclude from the processing files with the specific extensions.
public class AuthenticationModule : IHttpModule
{
private static readonly List<string> extensionsToSkip = AuthenticationConfig.ExtensionsToSkip.Split('|').ToList();
// In the Init function, register for HttpApplication
// events by adding your handlers.
public void Init(HttpApplication application)
{
application.BeginRequest += new EventHandler(this.Application_BeginRequest);
application.EndRequest += new EventHandler(this.Application_EndRequest);
}
private void Application_BeginRequest(Object source, EventArgs e)
{
// we don't have to process all requests...
if (extensionsToSkip.Contains(Path.GetExtension(HttpContext.Current.Request.Url.LocalPath)))
return;
Trace.WriteLine("Application_BeginRequest: " + HttpContext.Current.Request.Url.AbsoluteUri);
}
private void Application_EndRequest(Object source, EventArgs e)
{
// we don't have to process all requests...
if (extensionsToSkip.Contains(Path.GetExtension(HttpContext.Current.Request.Url.LocalPath)))
return;
Trace.WriteLine("Application_BeginRequest: " + HttpContext.Current.Request.Url.AbsoluteUri);
}
}
In config file specify what extensions should be excluded and initiate the list of extensions in the module.

Resources