Thursday, January 02, 2014

#Error in local report parameter value and expressions in Visual Studio 2010

I had faced this issue when i upgraded my VS2008 RDLC reports in VS2010 to adopt 2010 Schema (another night mare :)). I was using a local reprot to render in PDF format in my web apps and it consumes certein paramters to show in header, footer and also used in some of the expressions. Unfortunately, all my textboxes that used this paramter value displayed "#Error". I had spent almost around 3 hours on this and later realized the cause. This is due to some CAS (Code Access Security) recently implemented in .net 4.0 framework. We need to give additional permission to evaluate the expression in RDLC report. Details are mentioned here in the blog nicely.

Here is the sample code of mine. The object "report" represents local report object (LocalReport report = new LocalReport();)


ReportParameter[] parameters = new ReportParameter[4];
ReportParameter p2 = new ReportParameter("datetime_format", SessionContext.CurrentSessionDateTimeFormat);
ReportParameter p3 = new ReportParameter("date_format", SessionContext.CurrentSessionDateFormat);
ReportParameter p4 = new ReportParameter("currency", "All transactions are in " + SessionContext.CurrencyCode);
//
parameters[0] = new ReportParameter("request_no", requestNo);
parameters[1] = new ReportParameter("datetime_format", SessionContext.CurrentSessionDateTimeFormat);
parameters[2] = new ReportParameter("date_format", SessionContext.CurrentSessionDateFormat);
parameters[3] = new ReportParameter("currency", "All transactions are in " + SessionContext.CurrencyCode);
//
report.SetBasePermissionsForSandboxAppDomain(AppDomain.CurrentDomain.PermissionSet.Copy());
// Added above line to grant additional permission to execute the expression assembly
//
report.SetParameters(parameters);


Cheers...

Note: The above fix is required for the expressions/formulas to work properly in the new version.

Thursday, March 04, 2010

Microsoft® Tech·Ed Middle East 2010

Oh..at last i got the opprotunity to attend the Tech-Ed 2010 MENA. The even was very successfull, being attended by professionals from across Midde East and Africa.

I have got the wonderful chance to meet Joel and Shahid Gaglani (once again). Joel as always done sessions with smiles and Shahid was not lined up for the session (unfortunately).

The other exciting figures of the event are Scott Hanselman and Micheal Noel!. Scott is excellent in his work, his session was awesome!...You are the man!.. You made the Asp.net MVC simpler to me.

Noel, you are the ocean of knowledge. You have the stuff to speak!

The very interested tracks were on MVC and SharePoint!

Wednesday, November 04, 2009

Friday, June 05, 2009

Microsoft Search Engine - Bing

Microsoft has formally launched its new "decision engine" called Bing,
Try www.bing.com

Tuesday, May 19, 2009

How to return value from window.showModalDialog to parent window in javascript ?

Here is the example

Function to open dialog window from parent window

function showFleetDialog()
{
var oReturnValue = window.showModalDialog("/abc/page.aspx", this, "dialogWidth:800px;dialogHeight:500px;resizable:yes;");
if(oReturnValue != null)
document.getElementById('<%= txtFleetNo.ClientID %>').value = oReturnValue.FleetCode;
return false;
}

Function to retun value from dialog window
function closeThisWindow(fleetCode, fleetId)
{
var o = new Object();
o.FleetCode = fleetCode;
o.FleetId = fleetId;
window.returnValue = o;
window.close();
}

</dotnetSoldier>

Wednesday, April 22, 2009

Failed to decrypt the Web.config in asp.net

After encrypting the appSettings in web.config file using the command

aspnet_regiis -pef "appSettings" "c:\<appfolder>"
you may recieve the following error

"Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened."

or the site will not work since it cannot read/decrypt the web.config contents (connection string or any similiar data).

Resolution
This is because your ASP.NET application identity does not have access to the .NET Framework configuration key store. To give rights use the following command

aspnet_regiis -pa "NetFrameworkConfigurationKey" "<application pool identity account>"

Hope this helps..

Monday, January 19, 2009

Millions effected with windows worm - Conficker, Kido or Downadup

The worm Conficker was discovered in October 2008. Anti-virus firm F-Secure estimates there are now 8.9m machines infected.

According to Microsoft, the worm works by searching for a Windows executable file called "services.exe" and then becomes part of that code. It then copies itself into the Windows system folder as a random file of a type known as a "dll". It gives itself a 5-8 character name, such as piftoc.dll, and then modifies the Registry, which lists key Windows settings, to run the infected dll file as a service.

Once the worm is up and running, it creates an HTTP server, resets a machine's System Restore point (making it far harder to recover the infected system) and then downloads files from the hacker's web site.

Anti-virus firm F-Secure says that the worm uses a complicated algorithm to generate hundreds of different domain names every day, such as mphtfrxs.net, imctaef.cc, and hcweu.org. Only one of these will actually be the site used to download the hackers' files. On the face of it, tracing this one site is almost impossible.

Once the worm is running on the computer, it makes it very hard for users to restore their machine to a safe point before their operating system was infected, and automatically starts to download more malicious programs, that further compromise the PC, from hackers’ websites.

It’s using multiple replication mechanisms, including USB sticks, so if someone got an infection from one company and then takes his USB stick to another firm, it could infect that network too.

Computers users are advised to ensure their anti-virus software, operating system and firewall is up to date, and that they have installed a Microsoft patch designed to combat the problem, MS08-067, which is available from the Microsoft site.

Read More from BBC...

Friday, January 09, 2009

Get GridViewRow in button click event in GridView control

When we use template field columns with buttons in gridview, we may need to access the row number to find the datakeys in the button click event. And here is the code how it looks like..

protected void lnkBtnCheckIn_Click(object sender, EventArgs e)
{
LinkButton lnkButton = sender as LinkButton;
GridViewRow row = lnkButton.Parent.Parent as GridViewRow;
int fleetMovemetId = 0;
int.TryParse(Gridview1.DataKeys[row.RowIndex].Values[1].ToString(), out fleetMovemetId);
}

Njoy..

DataFormatString in GridView control

Here is the DataFormatString for date as 02-Jan-2009 02:10 PM in gridview in asp.net

<asp:boundfield headertext="C.I. Date & Time" datafield="checkin_datetime" htmlencode="false" dataformatstring="{0: dd-MMM-yyyy hh:mm tt}" />

-::HTH::-

Error in Asp.Net : "Redirect URI cannot contain newline characters"

While you send the error message as query string to an error page using response.redirect method in asp.net, you may come across the following error.
To get through, you should use URLEncode and URLDecode alone or with combination of HTMLEncode and HTMLDecode.

Eg:-
Response.Redirect(@"~/errorpage.aspx?.err=" + Server.UrlEncode(exception.Message) + "&.src=" + Server.UrlEncode(exception.Source));

Tuesday, December 30, 2008

File v/s BLOB storage in applications

This is my one of the old articles on File storage in applications. May help some readers..
http://www.codeproject.com/KB/database/File_Vs_Blob_Storage.aspx

BLOB Storage in SQL Server. How to store and retrive BLOBS in asp.net application

I have written an article on how to work on BLOB objects in asp.net and sql server. This may help the novice application developers.

http://www.codeproject.com/KB/database/Store_and_manipulat_BLOBs.aspx

-:HTH:-

How to improve site performance by compressing ViewState ?

Here is an article that describes how to improve aspnet site peroformance by compressing viewstate. Worth reading...http://www.dotnetbips.com/articles/22d33d11-1a75-42c8-bbf6-ca1a345d3fcf.aspx

Best ASP.NET FAQ for interviews

Here are some useful links...

http://www.syncfusion.com/faq/aspnet/

http://www.aspnetfaq.com


http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4081&lngWId=10

http://www.techinterviews.com/?p=193

http://blogs.crsw.com/mark/articles/254.aspx

Shopping Cart Web Template

Here is a nice shopping cart web template..Take it up from there...
http://demo.x-cart.com

:)

Another free CSS web template

This will help the beginners to start with the simple site design and layouts..
Grab it..
http://www.free-css-templates.com

Mini icons for your web applications....

Here are some nice icons which we can use it inside the controlsa and for CSS while developing web applications...

http://icons.primail.ch/

Digg it....

Disaster Recovery in SharePoint Products and Technologies 2003

The below informations will help you a lot when you start managing the SharePoint server farm of your organization since failure is not an option for us (IT) !

This URL points to a page on TECHNET that may interest you:
http://technet.microsoft.com/en-us/library/cc750142.aspx

How to perform a disaster recovery operation of Windows SharePoint Services 2.0 Companyweb and Windows SharePoint Services 2.0 databases?
http://support.microsoft.com/default.aspx/kb/827701

Move SharePoint sites across server farm
http://blogs.msdn.com/priyo/archive/2006/03/24/559896.aspx

I thought this Help and How-to article from Microsoft(R) Office Online might interest you. "Back up, restore, or move a SharePoint site"

-::HTH::-

Ajax pre-loader image online generator

Here we go!...http://www.ajaxload.info/
You can have your own ajax pre-loader...build your own styles..

Ziyad