viernes, 17 de julio de 2015

Peticiones perdidas en Fiddler

En un proyecto se necesitaba llamar un servicio web desde el backend, luego de realizar la peticion, el servicio retornaba error. Para ver si era un posible error en con los encabezados o algun formato en la paticion se inicio el fiddler para capturar el trafico, pero este no estaba logrando mostrar la peticion a pesar de que desde el visual studio ya se habia configurado el proyecto para usar el fiddler como proxy. Tambien se noto que la peticion si era captura pero desaparecia inmediatamente
Buscando en internet se encontro un foro donde se recomdeba activar el modo Troubleshoot del fiddler el cual al parecer apagaba los filtros que pudiesen estar escondiendo la peticion


luego de activarlo y realizar nuevamente la peticion esta se pudo visualizar aunque aparecia tachada para indicar que sobre esa peticion habian filtros aplicados



martes, 24 de marzo de 2015

'folder_name' not valid as filename in directory” in TortoiseSVN


When trying to check out a repository, You may get: 





This may be produced if your folder/file name has an empty space at the end of the file/name. The solution will be to rename the folder/file name via Repo-browser



Rename de folder/file





and it should be ok again


Hope it helps you, see you


martes, 17 de marzo de 2015

Secure cookies of being accessed from javascript

Hi newbie guys, today i will show you how to secure cookies of being accessed from javascript. Website cookies by deafult are accessible from javascript hence they are vulnerable to a XSS attack.

Look, if type document.cookie on the browser console i get the current cookies an its values

non secure cookies

If you want to secure your cookies of being accessed from javascript you can use de HttpOnly flag

If the HttpOnly flag (optional) is included in the HTTP response header, the cookie cannot be accessed through client side script (again if the browser supports this flag). As a result, even if a cross-site scripting (XSS) flaw exists, and a user accidentally accesses a link that exploits this flaw, the browser (primarily Internet Explorer) will not reveal the cookie to a third party.
If a browser does not support HttpOnly and a website attempts to set an HttpOnly cookie, the HttpOnly flag will be ignored by the browser, thus creating a traditional, script accessible cookie. As a result, the cookie (typically your session cookie) becomes vulnerable to theft of modification by malicious script
Now, here is the code:

java

Cookie cookie = getMyCookie("myCookieName");
cookie.setHttpOnly(true);

Web.config (.NET)

This one has the advantage that is applaied to all site cookies, not just the one explicity set


<system.web>
    <httpCookies httpOnlyCookies="true"/>
</system.web>

c#


HttpCookie cookie = new HttpCookie(key, value);

cookie.HttpOnly = true;

Now, our cookies are safer



I hope this help you

lunes, 16 de marzo de 2015

Publish Visual Studio proyect from command line

Maybe, you need to set up an automatic build-publish-deploy proccess therefore publishing a visual studio proyect from command line is a must. It can be done very easiley with the following command:


[path to msbuild] "[path  to .csproj file]" /p:Configuration=[Debug|Release|Other you created]  /p:DeployOnBuild=true /p:PublishProfile=[project publish profile name]

e.g.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild "%~dp0AppFolder/MyProject.csproj" /p:Configuration=Production /p:DeployOnBuild=true /p:PublishProfile=Production_Profile 


NOTE: Due i am using a .bat file to executie my command, i use the %~dp0 "trick" that is replaced with the current path of the .bat file achieving a portable "deployer" script

The trick.bat has the following code:

echo %~dp0 pause

The output wil be




Now, if you execute the .bat you will get something like this

jueves, 18 de diciembre de 2014

Create self-signed certificate Online

The problem:


I wanna tell you the reason why i ended doing this. We were trying to build two site that comunicate with each other and share information though web services and resources like images...so basically what we did was to load images hoste in site A from site B like this:

<img src="www.B.com/image.png" >

Suddenly, de images loaded from site A whe showing properly, while the ones from B weren't loding at all an this error begin to show up



The problem was that site B had a self-signed certificated create with IIS with a domain we could not specify, as you see, the only field i can fill was de friendly name but the domain was out of my control



So Google Chrome (and IE) didn't want to load the images hosted in site B because the self-signed certificate domain did not match the site domain.

The solution:


We created a other self-signed certificate but especifing the domain we need in this page

http://www.selfsignedcertificate.com/






Download this files


Problem 2:

To be able to set the newly create certificate in the ISS site we need to convert it into a .PBX file








Solution 2:

We converted the .cert file to .PFX using this page

https://www.sslshopper.com/ssl-converter.html




In 1. The certificate downloaded in


In 2. The certificate downloaded in



In 3. we select Standard PEM and 4. we select PFX/PKCS#12

In 5. we enter any password we like

Then all we need to do is import the .pfx file in the IIS and set it to out B site




Have good luck... ;)

martes, 17 de junio de 2014

Lateral Menu with fluid content

HTML Code:


<!DOCTYPE HTML>
<html>
<head>
<link href="./my.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="div1">
<nav>
<div id="menucontent">
<div id="logo">
<a href="#"><img src="img/logo.png"></a>
</div>
<div>
<div class="desplegable">
<div class="borde">
<a href="#">Operación <span class="iconMenu"></span></a>
</div>
<ul>
<li> <a href="#">Turnos de patio</a></li>
<li> <a href="#">Turnos de administración</a></li>
<li> <a href="#">Conciliación</a></li>
</ul>
</div>

<div class="desplegable">
<div class="borde">
<a href="#">Consultas y reportes <span class="iconMenu"></span></a>
</div>
<ul>
<li> <a href="#">Consolidado de operaciones</a></li>
<li> <a href="#">Convenios de clientes</a></li>
<li> <a href="#">Estado de turnos</a></li>
<li> <a href="#">Estado de cuenta deudores</a></li>
<li> <a href="#">Cierre de jornada fiscal</a></li>
</ul>
</div>

<div class="desplegable">
<div class="borde">
<a href="#">Configuración <span class="iconMenu"></span></a>
</div>
<ul>
<li> <a href="#">Turnos de patio</a></li>
<li> <a href="#">Turnos de administración</a></li>
<li> <a href="#">Conciliación de turnos</a></li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<div id="div2">
</div>
</body>
</html>

CSS Code:



* {
    padding: 0;
    margin: 0
}

#div1, #div2 {
    width: 170px;
}

#div1 {
    background-color: red;
    display: inline-block;  float: left;
}

#div2 {
   background-color: blue;
   
   margin-left: 178px;  height: 50px;
   width: 100%;
}

Center Container With Variable Content

Code:

<html>
<head>
<title>Paginita</title>

    <style type="text/css">
        #menu {
            margin: 0;
            padding: 0.5em;
            font-family: Verdana,sans-serif;

            position: relative;
            left: -50%;
         }
       
         #menu li {
           float: left;
           list-style-type: none;
           margin: 0 0 0 0.5em;
           padding: 0.25em;
           background-color: #600;
           color: #ff9;
           border: 2px solid #f00;
         }
       
         #menu a {
           color: #ff9;
           text-decoration: none;
         }
       
         .wrap {
           float: left;
           margin-bottom: 2em;
           position: relative;
           left: 50%;
           background-color: orange;
         }
       
         .clear {
           clear: left;
           height: 1px;
           margin-top: -1px;
         }
    </style>
</head>
<body>

        <div class="wrap">
            <ul id="menu">
                <li><a href="#">Home</a></li>
                <li><a href="#">News</a></li>
                <li><a href="#">Products</a></li>
                <li><a href="#">Services</a></li>
            </ul>
        </div>

        <!--Internet Explorer needs this-->
        <div class="clear"></div>
    </script>
</body>
</html>

Result




Paginita