Archive
Blank.gif missing error on ReportViewer
Problem : While going through one of our web product, i got a report with a missing image on it. when i check the other reports also, all were having same issue. Reports were developed using RDLC. i was using google chrome. But this issue was not there on IE. Might be first time i found that IE is working and all other browsers not working.
The html code was like this, related to missing image.
But i checked the report design and blank.gif image is not used anywhere. so i assumed that this should be an issue with report viewer.
I was correct when i checked on google. As mentioned on the below URl, issue with the report viewer.
https://connect.microsoft.com/VisualStudio/feedback/details/556989/
I used one of workaround, this link mentioned and it is fixed now. that was adding following code to global.asax.
void Application_BeginRequest(object sender, EventArgs e)
{
// Bug fix for MS SSRS Blank.gif 500 server error missing parameter IterationId
// https://connect.microsoft.com/VisualStudio/feedback/details/556989/
if (HttpContext.Current.Request.Url.PathAndQuery.StartsWith(“/Reserved.ReportViewerWebControl.axd”) &&
!String.IsNullOrEmpty(HttpContext.Current.Request.QueryString[“ResourceStreamID”]) &&
HttpContext.Current.Request.QueryString[“ResourceStreamID”].ToLower().Equals(“blank.gif”))
{
Context.RewritePath(String.Concat(HttpContext.Current.Request.Url.PathAndQuery, “&IterationId=0”));
}
}
Installshield LE Dependency dll build issue
I was trying to make an Win app installer package with installshield limited edition. I added the project primary output and the setup built successfully, it is installed correctly but now the problem is,
Three of the referred projects dlls are properly built, but one project dll is not latest. meaning that an old version of that dll is built and copied in the setup.
After hours searching on the google, trying rebuilding and trying changing project build order, still couldn’t overcome the issue. But finally this was the solution.
1. Open File option on installshield project. (Setup project –> (2)Specify Application Data –> File)
2. Go to destination computer files.
3. Right click on Primary Output and select ‘Dependencies from scan at build’.
4. That’s It. anyway i hate this new Installshield LE, previous setup and deployment option was much simpler.
(Will add a screen later, right now i am getting error when try to attached image to post. )
Decimal TextBox with jQuery
Problem : I had to work with formatting decimal places for a quantity text box (or label) on a halfway developed project. I wanted a solution, where i can handle this on one place and applies everywhere with quantity text box.
Solution :
1. Placed this code on the master page, This section will
- Format all the textboxes content with specific css (QuantityTextBox in this example) on page load,
- allow to enter only numeric values with one decimal mark. (onkeydown, will call the js function called OnlyDecimalNumbers).
- after entering the data, input will format on leave (on onblur event)
var decimalPoints = Number(‘<%: DecimalPoints%>’); //getting number of decimal points from serverside, which user can //defines
$(“.QuantityTextBox”).each(function () {
var originalText = Number($(this).val());
$(this).val(originalText.toFixed(decimalPoints));
});$(“.QuantityTextBox”).live(“keydown”, function (event) {
return OnlyDecimalNumbers(event, $(this));
});$(“.QuantityTextBox”).live(“blur”, function () {
var stringValue = $(this).val();
var lastChar = stringValue[stringValue.length – 1];
if (lastChar == ‘.’) {
stringValue = stringValue.slice(0, stringValue.length – 1);
}var originalText = Number(stringValue);
$(this).val(originalText.toFixed(decimalPoints));
});
2. Added following function on JS file.
//common function to use for allowing only numbers with decimal places. call on onkeydown
function OnlyDecimalNumbers(event, control) {
var existingValue = control.val();
var charCode = (event.which) ? event.which : event.keyCode;if (event.shiftKey)
return false;if (charCode == 46 || charCode == 8)
return true;if (existingValue.indexOf(“.”) == -1 && charCode == 190)
return true;if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;return true;
}
3. Finally add “QuantityTexBox” css on all the quantity showing/adding textboxes.
Pros on this solution : Can handle all the quantity related formatting on one place, if we have added above css on all the qty textboxes.
Cons : If we need to different CSS per textboxes for styles, we cannot do this, on my situation we were not adding styles directly to textboxes.
Debugging Windows Service
I was working with a windows service nearly one year and hopefully I will be working with this in next couple of months, may be next couple of years due to working on a product based company. 🙂
As most of the developers have experienced, it was a headache to debug a windows service. So think about working with a same windows service around a yearL. Very beginning I found a solution. That was
- Have a key on app.config as “DebugMode=true”
- In the code, I have put following line of code, where I mostly want to debug. (if I want new place, I add same code there) DebugMode value will be assigned based on app.config key.
if (DebugMode)
System.Diagnostics.Debugger.Launch();
- This was fine. But issue was with this way is,
Every time I had to compile the code, prepare the setup, uninstall and install on machine. If single line of code changed, had to follow same steps. (Installed version of code and IDE code version should be exactly match)
So today I came up with a better solution. Simple steps. But it saves time, especially when release is nearby :).
- Get rid of config key 🙂
- Above debug mode property populated by this way. This will get value based on configuration. If we select debug, this will be true and if we select release, this will be false.
public static bool DebugMode
{
get
{
bool isDebugMode = false;
#if DEBUG
isDebugMode = true;
#endif
return isDebugMode;
}
}
- I will add here whole Main method of Program.cs class. Only we need to change is, select the correct configuration. After finish the debug, select configuration as ‘release’ and build the setup. Don’t be confused with the code. what I do here is,
- If debug mode is true, do exactly what I do in the windows service class and start the application. You have to change the project type to ‘console application’ to open the console. But what I wanted here is not to see console, I just wanted to hit the break point without going through set of steps.
- If debug mode is false, call the windows service as normally.
static void Main()
{
if (DebugMode)
{
try
{
string serverURL = string.Format(“http://localhost:{0}/”, ConfigurationManager.AppSettings[“ServerPort”]);
AppHost _appHost = new AppHost();
MiddleWareEngine = new MiddleWareEngine();
MiddleWareEngine.StartEngine();//starting middleware
//Now run the Services.
_appHost = new AppHost();
_appHost.Init();
_appHost.Start(serverURL);
Console.WriteLine(string.Concat(“Middleware Server Started on “, serverURL));
}
catch (Exception ex)
{
Console.WriteLine(“Error: ” + ex.Message);
}
}
Else //Release mode
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[] { new DominateRFIDAlertService() };
ServiceBase.Run(ServicesToRun);
}
}
Good Bye Visual Studio Installer Projects
As Microsoft had announced on 2010 , Visual Studio Installer Projects have been removed with latest Visual studio release. (VS 2012). Recently i was trying to convert our existing VS 2010 solution to vs 2012, got the problem. All the other projects on the solutions were converted successfully and Setup project gave error as project type not installed. At first i thought that i have to create all the setup project from the beginning. But with few steps, could convert all to ‘InstallShield Limited Edition’ projects.
- InstallShield Limited Edition is not installing when we install VS 2012. (I am not sure with other versions, but i use VS 2012 ultimate and it didn’t had InstallShield Limited Edition installed)
- Even after installing InstallShield Limited Edition, those setup project will not convert by opening it. (which i thought that way would work)
- First open the Vs 2010 solution with VS 2012, it converts all other projects with error of setup project cannot convert.
- Remove existing setup project from solution.
- open add new project dialog for solution. select the ‘Other project type’ and select the ‘InstallShield Limited Edition Project’
- It should not be installed if you didn’t install it previously. so when you try to open the project it will show a message on browser to download the InstallShield Limited Edition
- Follow the instruction and download the InstallShield setup. they will send the key to activate to entered email address.
- After install, you might have to restart the VS. enter received serial no and activate
- Now same as step 5, add InstallShield setup project and on the InstallShield menu on main menu, select ‘Visual Studio Deployment Project Import Wizard…’
- Select your vs 2010 setup project file. Hopefully it will convert without error. i didn’t had to do any changes on converted project.
How to avoid ‘WebForms.PageRequestManagerServerErrorException’ error
This error i got suddenly, when i use partial post back to server on Asp.net aspx page. this page was working perfectly for months and today only i got this. After looking into this sometime, only thing has changed here is now i have more data on the page. But there is no way to catch the error and visual studio is returning this error when i click any control on the page.
When i look on the windows event log, exception was logged there as,
Operation is not valid due to the current state of the object.
at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
at System.Web.HttpRequest.FillInFormCollection()
What has happen was because of more data on the page, It is generating “ThrowIfMaxHttpCollectionKeysExceeded” error.
To overcome this issue you have to add following key to web.config as follows,
<appsettings>
<add key=”aspnet:MaxHttpCollectionKeys” value=”2000″></add>
</appsettings>
P/S : After looking into this issue on the web, i found this information,
Microsoft released a security update KB2656356 / MS11-100 for ASP.NET to address a potential Denial of Service vulnerability. In the update, Microsoft introduced a limit to the number of data elements on an ASP.NET form. The default limit is 1000 data elements. Exceeding the limit will cause a ThrowIfMaxHttpCollectionKeysExceeded error.
After applying the patch to your webserver, forms that exceed the limit will generate the following error when posting:
Programming in HTML5 with JavaScript and CSS3 (Exam 70-480)
FREE EXAM VOUCHER FOR 70-480! | Register now to take Exam 70-480 Programming in HTML5 with JavaScript and CSS3 for FREE! Just use this voucher code when scheduling your exam: HTMLJMP (voucher code available through 3/31/2013 or while supplies last.)
- https://www.microsoftvirtualacademy.com/tracks/developing-html5-apps-jump-start
- http://www.microsoft.com/learning/en/us/exam.aspx?id=70-480
- http://davidpallmann.blogspot.in/2012/08/microsoft-certification-exam-70-480.html
- http://channel9.msdn.com/posts/Developing-HTML5-Apps-Jump-Start-01a-HTML5-Semantic-Structure-Part-1
- http://www.techexams.net/forums/microsoft-developers-certifications/79076-70-480-programming-html5-javascript-css3.html
What’s New in Visual Studio TFS 2012
While playing with new TFS which comes with visual studio 2012, i got to know that it is now having more support for agile methodologies. Rather writing my own post about new TFS 2012, i found a very good and organized article, which describe everything with TFS 2012.
http://mohamedradwan.wordpress.com/2012/05/30/whats-new-in-tfs-2012-management-tool/
Before buy it, you can try it with http://tfspreview.com/ . Site itself explaining new features and how to use it. i created test project under TFS Preview, created few test tasks, added few classes on VS under that task, used code review, TRIED with creating with build. Just simple test. but feel new TFS is awesome.