Thursday, September 4, 2014

.Net C# - How to Bypass invalid SSL certificate errors when calling web services from .Net

C# (ASP.Net) error
Error:
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
and:
The remote certificate is invalid according to the validation procedure.

Below code can be used to bypass ssl related errors while calling webservices from your .net code


string sUrl = "http://mysite.com/myservice";
System.Net.WebClient client = new System.Net.WebClient();
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
string sHttpResonse = client.DownloadString(sUrl);

HP Fortify Software Security Center (SSC) install - Deploying Software Security Center in Tomcat

On Deploying Software Security Center in Your Application Server ==> Deploying Software Security Center in Tomcat

From documentation:
Extract the ssc.war file contents into a deployment folder in the Tomcat installation directory


You need to extract the contents. For this, you can use winzip or 7-zip or even rename the .war as zip and open in windows explorer. Extract the contents in folder tomcat_directory_root\webapps (create a new folder ssc over here ie; under webapps)

Wednesday, September 3, 2014

HP Fortify Software Security Center (SSC) install - Error while trying to seed process templates


Seeding a New Fortify Software Security Center (SSC) Database

In SSC configuration tool, option database setup, Seed process Templates was giving an unexpected error.

The HP-Fortify-Server-WAR\logs\ssc-configuration.log file had the below

INFO 2014-09-03 22:55:20,586 [com.fortify.server.configuration.db.DBUtil] - Error occurred during initialization of VM
Could not reserve enough space for object heap

ERROR 2014-09-03 22:55:20,596 [com.fortify.server.configuration.db.DBUtil] - Error seeding db

ERROR 2014-09-03 22:55:20,596 [com.fortify.server.configuration.db.DBUtil] - Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


After a lot of googling, found that the java VM is not able to allocate enough memory while starting from the host OS. Turns out all I had to do to fix is to edit the "ssc-configuration.cmd" file in "HP-Fortify-Server-WAR" folder and change MAX_MEMORY & MAX_PERMGEN to 512M from the default of 1024M. The seeding process went fine after this update :)

Wednesday, August 6, 2014

With only ASPX (asp.net) code, connect to SQL server database, and list table contents with query (no compilation or dll needed)

Mypage.aspx


<html xmlns="http://www.w3.org/1999/xhtml">
<head><title></title></head>
<body>
    <form id="form1" runat="server">
        <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" EnableModelValidation="True" AllowPaging="True" AutoGenerateColumns="true">            
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:maniConnectionString %>" SelectCommand="SELECT * FROM [Server_Capacity_1]"></asp:SqlDataSource>
    </form>
</body>
</html>
Sample web.config connecting to SQL Server


<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="MyConnectionString" connectionString="Data Source=myservername.com;Initial Catalog=MyDBName;Persist Security Info=True;User ID=myuserid;Password=myPassword"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

Hyperion interactive reporting studio BQY file grows large/huge over a period of time

If you use Brio to develop reports and save the file multiple time's you may have noticed that the file have grown huge over a period of time, and hence takes a long time to save. To reduce the file size, follow the below steps:

Warning: You will temporarily lose all data saved in the report (ie; generated report). Please don't try if you cannot generate it back and this data is important


  1. Open the bqy file in hyperion interactive reporting studio (I have tied this on 11.1.2)
  2. File --> Save Options --> Save Query Results with Document
  3. A small popup will open. In the left box that say query results, uncheck all boxes and hit OK
  4. Save the document. Now if you see the file size, it will be much smaller
  5. Close the report (or if you want, you can close the hyperion interactive reporting studio itself)
  6. Follow the below steps if you need to save the data as well
  7. Re-open the bqy report
  8. Process your report again so it will generate results
  9. File --> Save Options --> Save Query Results with Document
  10. A small popup will open. In the left box that say query results, check all boxes and hit OK
  11. Save the file
  12. You should have the data back, and the file size will be still much lower

Thursday, May 15, 2014

Creating a self signed certificate for development with subject alternative names

this is for IIS and assumption is Visual Studio is installed

cd C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin

makecert.exe -n "CN=My Development Root CA,O=My,OU=Development,L=Houston,S=TX,C=US" -pe -ss Root -sr LocalMachine -sky exchange -m 120 -a sha1 -len 2048 -r

makecert.exe -n "CN=mypc01, CN=mypc01.mydomain.net, CN=localhost, CN=mypc01.mycompany.com" -pe -ss My -sr LocalMachine -sky exchange -m 120 -in "My Development Root CA" -is Root -ir LocalMachine -a sha1 -eku 1.3.6.1.5.5.7.3.1

Saturday, April 26, 2014

ZyXEL NSA320 resetting admin password

Locate the reset button hole between the power connector and Ethernet cable at the back of the NSA box. Take a small pin and push the button until you hear a single beep (it will beep in about 1 or 2 seconds). Now remove the pin (ie; dont push anymore). Now, you can login with your default admin userid/password of admin/1234

None of your data or settings are lost by doing this!

Turn on Windows 11 Fast Boot

If windows starting is slow, to enable windows 11 fast startup/boot,  Press Windows + R, type powercfg.cpl, and hit Enter.  This will direct...