tag:blogger.com,1999:blog-313847222024-03-14T04:03:18.675-07:00:::Dots and nets::. Microsoft Developer Channelpublic class dotsAndNets{
"..i would change world but they won't give me
the source code" - 'X'
}dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.comBlogger69125tag:blogger.com,1999:blog-31384722.post-37873501984409824292014-01-02T03:26:00.001-08:002014-01-02T03:45:43.761-08:00#Error in local report parameter value and expressions in Visual Studio 2010I 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 <a href="http://blogs.msdn.com/b/brianhartman/archive/2010/02/18/expression-evaluation-in-local-mode.aspx">here</a> in the blog nicely.
<br><br>
Here is the sample code of mine. The object "report" represents local report object (LocalReport report = new LocalReport();)
<br><br><br>
ReportParameter[] parameters = new ReportParameter[4];<br>
ReportParameter p2 = new ReportParameter("datetime_format", SessionContext.CurrentSessionDateTimeFormat);<br>
ReportParameter p3 = new ReportParameter("date_format", SessionContext.CurrentSessionDateFormat);<br>
ReportParameter p4 = new ReportParameter("currency", "All transactions are in " + SessionContext.CurrencyCode);<br>
//<br>
parameters[0] = new ReportParameter("request_no", requestNo);<br>
parameters[1] = new ReportParameter("datetime_format", SessionContext.CurrentSessionDateTimeFormat);<br>
parameters[2] = new ReportParameter("date_format", SessionContext.CurrentSessionDateFormat);<br>
parameters[3] = new ReportParameter("currency", "All transactions are in " + SessionContext.CurrencyCode);<br>
// <br>
report.SetBasePermissionsForSandboxAppDomain(AppDomain.CurrentDomain.PermissionSet.Copy());<br>
// Added above line to grant additional permission to execute the expression assembly<br>
//<br>
report.SetParameters(parameters);<br>
<br>
<br>
Cheers...
<br>
<br>
<b>Note: The above fix is required for the expressions/formulas to work properly in the new version. </b>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com1tag:blogger.com,1999:blog-31384722.post-65099194029303957882010-03-04T02:21:00.000-08:002010-03-04T02:32:13.556-08:00Microsoft® Tech·Ed Middle East 2010Oh..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.<br /><br />I have got the wonderful chance to meet <a href="http://www.sharepointjoel.com/">Joel</a> and Shahid Gaglani (once again). Joel as always done sessions with smiles and Shahid was not lined up for the session (unfortunately).<br /><br />The other exciting figures of the event are <a href="http://www.hanselman.com/blog/">Scott Hanselman</a> and Micheal Noel!. Scott is excellent in his work, his session was awesome!...You are the man!.. You made the <a href="http://www.asp.net/(S(d35rmemuuono1wvm1gsp2n45))/mvc/">Asp.net MVC</a> simpler to me.<br /><br />Noel, you are the ocean of knowledge. You have the stuff to speak!<br /><br />The very interested tracks were on MVC and SharePoint!dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-9415987563993352182009-11-04T21:13:00.000-08:002009-11-04T21:15:28.217-08:00Active Directory and .NetExcellent resource for programming AD (LDAP) in .Net<br /><br /><a href="http://www.dotnettreats.com/tipstricks/adnet.aspx">http://www.dotnettreats.com/tipstricks/adnet.aspx</a>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-68494223100245379532009-06-07T21:54:00.000-07:002009-06-07T21:57:32.140-07:00Open Source IDE for .Net (Free...)The open source IDE for .net (Free Tool)<br /><a href="http://www.icsharpcode.net/OpenSource/SD/Default.aspx">http://www.icsharpcode.net/OpenSource/SD/Default.aspx</a><br /><br /></ Soldier>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-18758599745940625282009-06-05T23:45:00.003-07:002009-06-05T23:48:33.304-07:00Microsoft Search Engine - BingMicrosoft has formally launched its new "decision engine" called Bing, <br />Try <a href="www.bing.com">www.bing.com</a>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-70842398026468631842009-05-19T12:47:00.001-07:002009-05-19T12:51:11.722-07:00How to return value from window.showModalDialog to parent window in javascript ?Here is the example<br /><br /><strong>Function to open dialog window from parent window</strong><br /><br />function showFleetDialog() <br />{<br /> var oReturnValue = window.showModalDialog("/abc/page.aspx", this, "dialogWidth:800px;dialogHeight:500px;resizable:yes;");<br /> if(oReturnValue != null) <br /> document.getElementById('<%= txtFleetNo.ClientID %>').value = oReturnValue.FleetCode;<br /> return false;<br />}<br /><br /><strong>Function to retun value from dialog window</strong><br />function closeThisWindow(fleetCode, fleetId) <br />{ <br /> var o = new Object();<br /> o.FleetCode = fleetCode;<br /> o.FleetId = fleetId;<br /> window.returnValue = o;<br /> window.close();<br />}<br /><br /></dotnetSoldier>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-76631292857732164372009-04-22T22:09:00.000-07:002009-04-22T22:26:37.446-07:00Failed to decrypt the Web.config in asp.netAfter encrypting the appSettings in web.config file using the command<br /><br /><strong>aspnet_regiis -pef "appSettings" "c:\<appfolder>"</strong><br />you may recieve the following error <br /><br /><strong>"Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened." </strong><br /><br />or the site will not work since it cannot read/decrypt the web.config contents (connection string or any similiar data).<br /><br /><strong>Resolution</strong><br />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<br /><br /><strong>aspnet_regiis -pa "NetFrameworkConfigurationKey" "<application pool identity account>"</strong><br /><br />Hope this helps..dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-12937688017341332472009-01-19T20:12:00.000-08:002009-01-19T20:26:27.363-08:00Millions effected with windows worm - Conficker, Kido or DownadupThe worm Conficker was discovered in October 2008. Anti-virus firm F-Secure estimates there are now 8.9m machines infected. <br /><br />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.<br /><br />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. <br /><br />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.<br /><br />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.<br /><br />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.<br /><br />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, <a href="http://www.microsoft.com/technet/security/Bulletin/MS08-067.mspx">MS08-067, which is available from the Microsoft site</a>.<br /><br /><a href="http://news.bbc.co.uk/2/hi/technology/7832652.stm">Read More from BBC...</a>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-56991304911959567842009-01-09T12:36:00.001-08:002009-01-09T12:39:37.386-08:00Get GridViewRow in button click event in GridView controlWhen 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..<br /><br />protected void lnkBtnCheckIn_Click(object sender, EventArgs e)<br />{<br /> LinkButton lnkButton = sender as LinkButton;<br /> GridViewRow row = lnkButton.Parent.Parent as GridViewRow;<br /> int fleetMovemetId = 0;<br /> int.TryParse(Gridview1.DataKeys[row.RowIndex].Values[1].ToString(), out fleetMovemetId);<br />}<br /><br />Njoy..dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-92070358499722054082009-01-09T04:15:00.000-08:002009-01-09T04:19:54.547-08:00DataFormatString in GridView controlHere is the DataFormatString for date as 02-Jan-2009 02:10 PM in gridview in asp.net<br /><br /><asp:boundfield headertext="C.I. Date & Time" datafield="checkin_datetime" htmlencode="false" dataformatstring="{0: dd-MMM-yyyy hh:mm tt}" /><br /><br />-::HTH::-dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-65018417459037424452009-01-09T02:54:00.000-08:002009-01-09T12:40:23.022-08:00Error 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.<br />To get through, you should use URLEncode and URLDecode alone or with combination of HTMLEncode and HTMLDecode.<br /><br />Eg:-<br />Response.Redirect(@"~/errorpage.aspx?.err=" + Server.UrlEncode(exception.Message) + "&.src=" + Server.UrlEncode(exception.Source));dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com2tag:blogger.com,1999:blog-31384722.post-79334928342622100252008-12-30T01:49:00.000-08:002008-12-30T01:53:12.692-08:00File v/s BLOB storage in applicationsThis is my one of the old articles on File storage in applications. May help some readers..<br /><a href="http://www.codeproject.com/KB/database/File_Vs_Blob_Storage.aspx">http://www.codeproject.com/KB/database/File_Vs_Blob_Storage.aspx</a>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-50020114937293320952008-12-30T01:46:00.001-08:002008-12-30T01:49:00.641-08:00BLOB Storage in SQL Server. How to store and retrive BLOBS in asp.net applicationI have written an article on how to work on BLOB objects in asp.net and sql server. This may help the novice application developers.<br /><br /><a href="http://www.codeproject.com/KB/database/Store_and_manipulat_BLOBs.aspx">http://www.codeproject.com/KB/database/Store_and_manipulat_BLOBs.aspx</a><br /><br />-:HTH:-dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-13166279542501874362008-12-30T01:33:00.000-08:002008-12-30T01:35:18.878-08:00How to improve site performance by compressing ViewState ?Here is an article that describes how to improve aspnet site peroformance by compressing viewstate. Worth reading...<a href="http://www.dotnetbips.com/articles/22d33d11-1a75-42c8-bbf6-ca1a345d3fcf.aspx">http://www.dotnetbips.com/articles/22d33d11-1a75-42c8-bbf6-ca1a345d3fcf.aspx<br /></a>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-30756119317350674112008-12-30T01:30:00.001-08:002008-12-30T01:33:02.422-08:00Best ASP.NET FAQ for interviewsHere are some useful links...<br /><br /><a href="http://www.syncfusion.com/faq/aspnet/default.aspx">http://www.syncfusion.com/faq/aspnet/</a><br /><br /><a href="http://www.aspnetfaq.com">http://www.aspnetfaq.com</a><br /><br /><br /><a href="http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4081&lngWId=10">http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4081&lngWId=10</a><br /><br /><a href="http://www.techinterviews.com/?p=193">http://www.techinterviews.com/?p=193</a><br /><br /><a href="http://blogs.crsw.com/mark/articles/254.aspx">http://blogs.crsw.com/mark/articles/254.aspx</a>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-3030928506404881052008-12-30T01:24:00.000-08:002008-12-30T01:25:45.036-08:00Shopping Cart Web TemplateHere is a nice shopping cart web template..Take it up from there...<br /><a href="http://demo.x-cart.com">http://demo.x-cart.com</a><br /><br />:)dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-74598043203885900492008-12-30T01:23:00.000-08:002008-12-30T01:24:33.068-08:00Another free CSS web templateThis will help the beginners to start with the simple site design and layouts..<br />Grab it..<br /><a href="http://www.free-css-templates.com">http://www.free-css-templates.com</a>dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-16132939576369863302008-12-30T01:19:00.000-08:002008-12-30T01:20:59.488-08:00Mini 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...<br /><br /><a href="http://icons.primail.ch/ ">http://icons.primail.ch/ </a><br /><br />Digg it....dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-47878773784442213632008-12-30T01:09:00.000-08:002008-12-30T01:19:18.937-08:00Disaster Recovery in SharePoint Products and Technologies 2003The 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) !<br /><br />This URL points to a page on TECHNET that may interest you: <br /><a href="http://technet.microsoft.com/en-us/library/cc750142.aspx">http://technet.microsoft.com/en-us/library/cc750142.aspx</a><br /><br />How to perform a disaster recovery operation of Windows SharePoint Services 2.0 Companyweb and Windows SharePoint Services 2.0 databases?<br /><a href="http://support.microsoft.com/default.aspx/kb/827701">http://support.microsoft.com/default.aspx/kb/827701</a><br /><br />Move SharePoint sites across server farm<br /><a href="http://blogs.msdn.com/priyo/archive/2006/03/24/559896.aspx ">http://blogs.msdn.com/priyo/archive/2006/03/24/559896.aspx </a><br /><br />I thought this Help and How-to article from Microsoft(R) Office Online might interest you. <a href="http://office.microsoft.com/en-us/sharepointdesigner/HA100699391033.aspx?WT.mc_id=42 ">"Back up, restore, or move a SharePoint site"</a><br /><br />-::HTH::-dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-63551860543451875882008-12-30T01:07:00.000-08:002008-12-30T01:13:42.398-08:00Ajax pre-loader image online generatorHere we go!...<a href="http://www.ajaxload.info/">http://www.ajaxload.info/</a><br />You can have your own ajax pre-loader...build your own styles..<br /><br />ZiyaddotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-14929786435824984392008-12-30T01:01:00.000-08:002008-12-30T01:02:17.289-08:00Here is a joke!Long back, a person who sacrificed his sleep, forgot his family, forgot his food, Forgot laughter were called "Saints", But now they are called.. "<strong>IT professionals</strong>"dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-42768670888521064042008-12-29T04:44:00.000-08:002008-12-29T04:51:43.087-08:00Happy Holidays !Dear readers,<br />I wish you all Merry Christmas, Happy New Year and Happy Holidays !<br /><br />Rgds, ZdotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-14921077452382314692008-12-29T04:35:00.000-08:002008-12-29T04:38:23.143-08:00Tool to generate CSS Menu, CSS Button, CSS Page Layout, etc. and free templateHey developers, here is the nice tool to create your own CSS driven menu, web page layout, button and nice site template for free...<br /><br /><a href="http://www.cssportal.com/">http://www.cssportal.com/</a><br /><br />Hope this will help us in our work...dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-38081272787458767522008-12-28T09:25:00.001-08:002008-12-28T09:30:27.814-08:00How to render RDLC (local report) as excel in asp.net ?Here we go - to render the rdlc local report in asp.net web application<br /><br /><br /><span style="font-size:85%;"><span style="font-family: courier new;">public static void GenerateExcelFromLocalReport()</span><br /><span style="font-family: courier new;">{</span><br /><span style="font-family: courier new;"> //get your report datasource from the database </span><br /><span style="font-family: courier new;"> IDataReader iReader = GetReportDataSourceReader();</span><br /><span style="font-family: courier new;"> LocalReport report = new LocalReport();</span><br /><span style="font-family: courier new;"> report.ReportPath = HttpContext.Current.Server.MapPath("~/reports<br /> /rdlc/MyReport.rdlc");</span><br /><span style="font-family: courier new;"> report.DataSources.Add(new ReportDataSource("DataSource1", iReader));</span><br /><span style="font-family: courier new;"> ReportParameter[] parameters = new ReportParameter[3];</span><br /><span style="font-family: courier new;"> parameters[0] = new ReportParameter("Filter1", "Filter1's value"));</span><br /><span style="font-family: courier new;"> parameters[1] = new ReportParameter("Filter2", "Filter2's value");</span><br /><span style="font-family: courier new;"> parameters[2] = new ReportParameter("Footer", "Footer's value");</span><br /><span style="font-family: courier new;"> report.SetParameters(parameters);</span><br /><span style="font-family: courier new;"> //</span><br /><span style="font-family: courier new;"> //code to render report as excel document</span><br /><span style="font-family: courier new;"> string encoding = String.Empty;</span><br /><span style="font-family: courier new;"> string mimeType = String.Empty;</span><br /><span style="font-family: courier new;"> string extension = String.Empty;</span><br /><span style="font-family: courier new;"> Warning[] warnings = null;</span><br /><span style="font-family: courier new;"> string[] streamids = null; </span><br /><span style="font-family: courier new;"> //</span><br /><span style="font-family: courier new;"> byte[] byteArray = report.Render("Excel", null, out mimeType,<br /> out encoding, out extension, out streamids, out warnings);</span><br /><span style="font-family: courier new;"> //</span><br /><span style="font-family: courier new;"> HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";</span><br /><span style="font-family: courier new;"> HttpContext.Current.Response.AddHeader("Content-Disposition",<br /> "attachment; filename=MyExcel.xls");</span><br /><span style="font-family: courier new;"> HttpContext.Current.Response.AddHeader("Content-Length",<br /> byteArray.Length.ToString());</span><br /><span style="font-family: courier new;"> HttpContext.Current.Response.ContentType = "application/octet-stream";</span><br /><span style="font-family: courier new;"> HttpContext.Current.Response.BinaryWrite(byteArray);</span><br /><span style="font-family: courier new;"> HttpContext.Current.Response.End();</span><br /><span style="font-family: courier new;">}</span></span><br /><br />-::HTH::-dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com0tag:blogger.com,1999:blog-31384722.post-63547476266292104202008-12-28T09:07:00.000-08:002008-12-28T09:37:11.870-08:00How to generate or render .pdf document from local report (rdlc) with parameters ?Here is the code to render the rdlc (local report) as pdf document in asp.net web application.<br /><span style="font-size:85%;"><br /><span style=";font-family:courier new;font-size:85%;" >public void GeneratePDFFromLocalReport()<br />{<br /></span> <span style=";font-family:courier new;font-size:90%;" >//get your report datasource from the database<br /> IDataReader iReader = GetReportDataSourceReader();<br /> LocalReport report = new LocalReport();<br /> report.ReportPath =<br /> HttpContext.Current.Server.MapPath("~/reports/rdlc/MyReport.rdlc");<br /> report.DataSources.Add(new ReportDataSource("DataSource1", iReader));<br /> ReportParameter[] parameters = new ReportParameter[3];<br /> parameters[0] = new ReportParameter("Filter1", "Filter1's value"));<br /> parameters[1] = new ReportParameter("Filter2", "Filter2's value");<br /> parameters[2] = new ReportParameter("Footer", "Footer's value");<br /> report.SetParameters(parameters);<br /></span><span style=";font-family:courier new;font-size:85%;" > //<br /> //code to render report as pdf document<br /> string encoding = String.Empty;<br /> string mimeType = String.Empty;<br /> string extension = String.Empty;<br /> Warning[] warnings = null;<br /> string[] streamids = null;<br /></span><span style=";font-family:courier new;font-size:85%;" > </span> <span style=";font-family:courier new;font-size:85%;" >//<br /> byte[] byteArray = report.Render("PDF", null,<br /> out mimeType, out encoding, out extension, out streamids, out warnings);<br /> //<br /> HttpContext.Current.Response.ContentType = "Application/pdf";<br /> HttpContext.Current.Response.AddHeader("Content-Disposition",<br /> "attachment; filename=MyPDF.pdf");<br /> HttpContext.Current.Response.AddHeader("Content-Length",<br /> byteArray.Length.ToString());<br /> HttpContext.Current.Response.ContentType = "application/octet-stream";<br /> HttpContext.Current.Response.BinaryWrite(byteArray);<br /> HttpContext.Current.Response.End();<br />}</span></span><br /><br />-::HTH::-dotNetSoldierhttp://www.blogger.com/profile/15770261538029523668noreply@blogger.com1