Thursday, June 20, 2013

How to enable multiple Remote Desktop sessions in Windows Server 2012



1. Open up Windows Command prompt, type “gpedit.msc” and press OK.

 
2. Then you will be navigated to the Local Group Policy Editor.
 3. Double click on "Computer Configuration".
 

 4 .Then go to the location “Administrative Templates/ Windows Components/ Remote Desktop services /Remote Desktop Session Host / Connections” by double clicking the folders available in each window. 


5. Select “Restrict Remote Desktop Services users to a single Remote Desktop Services session” at the right pane. Then click on “Policy Setting” link.


6. Make the setting into “Disable” and press OK. 


7. Again open up the Windows Command prompt, type “gpupdate” and press OK.


8. Then you can see the following message on command prompt.


     Now you are done!!! :)

Monday, December 5, 2011

“The maximum report processing jobs limit configured by your system administrator has been reached”

Recently I had to find a solution for the above error during the development process of several crystal reports.

This occurs due to maximum number of concurrent report processes. Finally, I could find two ways to overcome this error.  I personally recommend the 2nd type because it’s the most accurate and effective way of solving this problem.

Method 01:

Simply you can increase the registry key value “PrintJobLimit” at the “[HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer]” (Crystal Reports 13.0).

This will solve your problem temporary, but it will occur again and again. Some people say that you will get unlimited number of print jobs when you set this value to -1, but in my case that didn’t happen.


Method 02:

Properly manage your document objects. That means make sure to close and dispose all your document objects when you leave a page. You could easily achieve this by doing it in “Page_unload” event.

rptMyReport objRptMyReport;

protected void Page_Load(object sender, EventArgs e)
{
If (objRptMyReport  ==  null)
objRptMyReport = new rptMyReport();
}

Use your document objects as you want…
But, make sure to dispose them…

protected void Page_Unload(object sender, EventArgs e)
{
 objRptMyReport.Close();
 objRptMyReport.Dispose();
}

This will be permanently resolved this issue.

Good Luck!!!
Happy Programming :)

Wednesday, January 19, 2011

How to show system time in ASP.NET web page


I’m going to achieve this using a timer and update panel.
Add the following code into page source.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Clock</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="smClock" runat="server">
        </asp:ScriptManager>
        <asp:Timer ID="tmrClock" runat="server" Interval="1000" OnTick="tmrClock_Tick">
        </asp:Timer>
        <asp:UpdatePanel ID="aupTime" runat="server" RenderMode="Inline" UpdateMode="Conditional">
            <ContentTemplate>
                <table>
                    <tr>
                        <td>
                            <asp:Label ID="lblTm" runat="server" Font-Bold="True" Font-Size="XX-Large" Text="CurrentTime ="></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblTime" runat="server" Font-Bold="True" Font-Size="XX-Large"></asp:Label>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="tmrClock" EventName="Tick" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

It is important to use an update panel, otherwise the whole page will get refreshed in every second (we are going to change the value of the label once in every 1000 milliseconds.). Make sure to put your timer within the update panel as well.

Add the following to your code file in order to get the system time and format it in the label.

    protected void Page_Load(object sender, EventArgs e)
    {
        lblTime.Text = DateTime.Now.ToString("HH:mm:ss");
    }
    protected void tmrClock_Tick(object sender, EventArgs e)
    {
        lblTime.Text = DateTime.Now.ToString("HH:mm:ss");
    }

Here I added the code inside the “Page_Load” event as well to make sure to display the time when page loads. Otherwise we have to wait 1 second to see the time.

Then you can see the system time like this,


Here I’m displaying in 24h format. If you want to display in 12h format use ("hh:mm:ss") instead of ("HH:mm:ss").

Good Luck!!!
Happy Programming :)