| Subcribe via RSS

View Page Source of dynamic/AJAX page

April 3rd, 2014 | No Comments | Posted in AJAX, ASP.NET

It's quite simple once you know it but without knowing how to do it but I had to spend good hour to find a way. I was debugging a cosmetic issue of a simple web app that has component of creating form fields dynamically. However with no way to view the source of dynamically changed page, it was hard to figure out where things have gone wrong. ‘View source' or ‘View page source' of IE and Firefox only showed initial state before the page was updated by javascripts. After bit of research, I've found there are two way to do it.

1. Using Firebug. Inspect function of the plug-in lets you view the changed source. Most of you who works with web related stuff should have this plug-in already. I had this plug-in for a while and used it quite often but for some reason, I didn't bother to check Firebug inspector until I've found the solution below.   If you don't have it already, you can download it here.

2. Simpler way if you want to quickly view the whole thing. In Firefox, control-A to select all. Then right click -> ‘View selection source' to view updated source.

Crystal Reports Permissions

When a Crystal Reports(rpt) file is loaded via ASP or ASP.NET, the web application need read/write permission to a temporary directory. I am told the location of temporary directory is defined in registry on a newer version of Crystal Reports. But the version we are using(10.0) don't have it defined in the registry and it trys to write temp file to default temporary directory.

You can easily find out where the CR is trying to write its temporary file by running utility like Filemon. Filemon can be downloaded here.

503 Proxy is busy. DisableBacklogMonitor ??

March 13th, 2014 | No Comments | Posted in General Server Administration, ISA Server

All of sudden for unkwon reason, our external client were getting following messages intermittently from our ISA server when trying to access one of our websites.

503 Proxy is busy – A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached. (1238)
Internet Security and Acceleration Server

Problem didn't go away even after increasing incoming web request limit to a very high number in ISA Server. Outgoing web request limit was set to unlimited. Puzzling aspect of the issue was that it happens more often during the off hours when traffics are at its lowest where as the error message suggest too many connections.  I've monitored various performance parameters such as Active TCP connections on firewall, Web Proxy Current users, Web Proxy http requests and TCP connections established. None of the parameters seemed out of ordinary.

  1. dumpsters Lompoc
  2. http://www.topdogdumpsterrental.com/dumpster-rental-in-corvallis-or
  3. http://www.topdogdumpsterrental.com/dumpster-rental-in-coconut-creek-fl
  4. dumpster rental prices
  5. Abilene TX dumpster
  6. http://www.topdogdumpsterrental.com/dumpster-rental-in-corpus-christi-tx
  7. Cedar Falls dumpster rental
  8. dumpster rentals in Lafayette
  9. http://www.topdogdumpsterrental.com/dumpster-rental-in-homestead-fl
  10. Oak Park dumpster
  11. dumpster rental prices
  12. topdogdumpsterrental.com
  13. dumpster rental in Rome GA
  14. http://www.topdogdumpsterrental.com/dumpster-rental-in-keizer-or
  15. http://www.topdogdumpsterrental.com/dumpster-rental-in-columbia-sc
  16. Downey dumpster
  17. Daly City dumpster rental
  18. rent a dumpster Olathe KS

After searching for answers on the web, I've found a suggestion to add DWORD called DisableBacklogMonitor in registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InetInfo\Parameters and set it to 1. This apparently disables backlog monitor. But there was no explanation of what it does and can't seem to find any clear explanation on the web other than to disable it as a fix of an issue or as a performance tuning tip.

With no other fix or work around, we did follow this registry hack(?) and restarted the services. It has been about two weeks since the fix and no more 503 error so far…

Execute a DTS Package from a Trigger

March 13th, 2014 | No Comments | Posted in SQL Server

There is a easy way to execute a DTS package from a trigger using system stored procedure called ‘xp_cmdshell' and command line utility called ‘dtsrun'. ‘xp_cmdshell' allows you to run a given command string as an operating system command shell and it returns output as text. ‘dtsrun' let you run DTS package in command prompt.

Syntax for xp_cmdshell
Syntax for dtsrun

You can simply execute xp_cmdshell ‘dtsrun …….' in your T-SQL statement to lauch the DTS package. 

For me, all the parameters available for ‘dtsrun' command was bit confusing. Fortunately, there is a very easy to build a ‘dtsrun' command string using dtsrun gui.

First go to Start -> Run and type ‘DTSRUNUI' and it will open dtsrun gui as follows.

Then choose your package to execute and click ‘Advanced' button. The following window will appear.

From this window add global variables if needed then click ‘Generate'. This utitility will generate command string for you as you can see in the blue circle above. Copy this string to your T-SQL. If you are passing any values to DTS package dynamically, you will have to edit the value of global variables to the parameters in your T-SQL.

Please note that it is normally not a good idea to run DTS package from a trigger as it will slow the transaction down significantly. Any transaction will take as long as time the DTS package need to complete.

Restoring DTS package from msdbdata.mdf without msdblog.ldf

February 19th, 2014 | 2 Comments | Posted in SQL Server

I was faced with challenge to restore a DTS package from a database that went down. Unfortunately, there was no proper back up other than a copy of msdbdata.mdf file. Additionaly, I had to restore the DTS package to existing production server without restarting it. The following is how I did it.

  1. 1. Install temporary instance of SQL Server 2014 on a box that can see the production server.
  2. 2. Stop the SQL server.
  3. 3. Locate msdbdata.mdf and msdblog.ldf from the data directory and move it to other location.
  4. 4. Place backed up msdbdata.mdf in the data directory.
  5. 5. Start the SQL Server. msdb database will be in suspect mode.
  6. 6. In query analyzer execute the following to allow updates to system tables.
    Use Master
    Go
    sp_configure ‘allow updates', 1
    reconfigure with override
    Go
  7. 7. In query analyzer execute the following to set the database in Emergency (bypass recovery) mode. This is required step in order to run next step.
    update sysdatabases set status = 32768 where name = ‘msdb'
  8. 8. Restart SQL server.
  9. 9. Rebuild the log with this code:
    DBCC TRACEON (3604)
    DBCC REBUILD_LOG(‘msdb','msdblog.ldf')
  10. 10. At this point I was able to open the DTS package in Enterprise Manager. While the DTS package is open, I did Package->Save as.
  11. 11. Choose the production server from the server list and click OK.
  12. 12. Remove temporary instance of SQL Server 2014.

How to reset/kill Remote Desktop Connection(RDP) remotely

February 19th, 2014 | No Comments | Posted in General Server Administration

If you are using RDP connection regularly, you probably have ran into message "The terminal server has exceeded the maximum number of allowed connections". Fortunately, there is way to reset RDP connection remotely from command prompt.

In command prompt, execute following commands to kill terminal services sessions remotely. Replace blue with your own parameters.

Step 1. Gain enough privilidge to kill RDP connection on the server.
net use \\servername_or_IP /USER:username "password"

Step 2. List the connection to a particular server and get session ID.
query session /server:servername

Step 3.  Reset the session which you don't need using ID of the session from Step 2.
reset session ID /server:servername_or_IP

That's it! However it seems that on some machines, query.exe and reset.exe are not available. If that's the case, try qwinsta.exe and rwinsta.exe respectivly in place of query.exe and reset.exe. Alternatively, you should be able to find query.exe and reset.exe in "C:\WINDOWS\System32\dllcache". Copy the files to System32 directory and you are good to go.

Forms Authentication with Active Directory and Client's file access using Impersonation

February 18th, 2014 | No Comments | Posted in ASP.NET

I had to build simple intranet ASP.NET application which required AD authentication. The application need to read a file from client's local hard whch is used by legacy application. The following is brief summary of how it was implemented.

AD form authentication was implemented using MSDN article as a reference. Even after authentication, ASP.NET runs under default ASP.NET application account. Unless  you are running ASP.NET under high priviledge accountlike Domain Admin, the application will not have access to client's local files. Impersonating a user who is authenticating against AD let me have access to client's local files.  

 

First, I have enabled impersonation in Web.Config

<identity impersonate="true" />

 

Then, I have impersonated the account logged in, read what I need from client's local file.

//Start impersonating.
System.Security.Principal.WindowsImpersonationContext _ic;
_ic = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();

//Access client's files using UNC path. For example, C drive would be \\ClienIP\c$.

//Stop impersonating.
_ic.Undo();

 

Reference: WindowsImpersonationContext Class(.NET Framework Class Library)

SQL Server 2014 MSDE: "Remove files older than:" is blank?!

February 17th, 2014 | No Comments | Posted in SQL Server

While trying to add maintenance plan for one of SQL Server 2014 MSDE, I've found that "Remove files older than:" dropdown is blank(See screenshot A).

I have found that Enterprise Manager expects to find a value for "BackupDirectory" at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer.

Setting this REG_SZ value to any directory (for example, "C:\Program
Files\Microsoft SQL Server\MSSQL\BACKUP") solves the problem. See the screenshot B after adding the registry value.  Apparently this is a bug which was introduced on SP3 but I cannot verify this.