Foros del Web » Programando para Internet » ASPX (.net) »

Inicio de Sesión Automático HttpWebRequest

Estas en el tema de Inicio de Sesión Automático HttpWebRequest en el foro de ASPX (.net) en Foros del Web. Hola buenas tarde. Estoy haciendo un desarrollo, donde me pasan de otro sistema una imagen por medio de una URL, pero esta no se muestra, ...
  #1 (permalink)  
Antiguo 21/10/2014, 18:22
 
Fecha de Ingreso: septiembre-2014
Mensajes: 3
Antigüedad: 9 años, 6 meses
Puntos: 0
Inicio de Sesión Automático HttpWebRequest

Hola buenas tarde.

Estoy haciendo un desarrollo, donde me pasan de otro sistema una imagen por medio de una URL, pero esta no se muestra, ya que necesito iniciar sesión en dicho sistema, ya iniciada la sesión la imagen se ve sin problemas, el punto es que no se puede iniciar la sesión manual, hay que hacerlo por automático.

Estoy obteniendo el HTML de la siguiente ruta.

http://localhost/carpeta/loginDA.aspx

con este codigo.

Código:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost/carpeta/loginDA.aspx");
request.AllowAutoRedirect = false;
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 
StreamReader readStream = new StreamReader(response.GetResponseStream());
string html = readStream.ReadToEnd();
la variable html ya trae la siguiente info.

Código HTML:
<body>
    <form method="post" action="loginDA.aspx" id="frmLogin">
   <tr>
            <td valign="top"><table cellspacing="0" cellpadding="0" width="200">
<tr>
                    <td>
                        <img class="dxWeb_rpHeaderTopLeftCorner_Office2010Silver" src="/Archivero/DXR.axd?r=1_10-eIuD8" alt="" />
                    </td>
                    <td class="dxrpTE">
                        <div style="font-size:1px;"></div>
                    </td>
                    <td>
                        <img class="dxWeb_rpHeaderTopRightCorner_Office2010Silver" src="/Archivero/DXR.axd?r=1_10-eIuD8" alt="" />    
                    </td>
</tr>
                <tr>
                    <td class="dxrpHLE">
                        <div style="font-size:1px;"></div>
                    </td>
                    <td class="dxrpHeader_Office2010Silver" height="1%" style="padding-padding-right:11px;padding-padding-bottom:6px;">
                        <table cellspacing="0" cellpadding="0" width="100%" style="border-collapse:separate;">
           <tr>
           <td class="dxrp" width="100%">
                                    <span id="rndPanel_RPHT">Sistema de Digitalización</span>
                                </td>
   </tr>
   </table>
                    </td>
                    <td class="dxrpHRE">
                        <div style="font-size:1px;"></div>
                    </td>
</tr>
                <tr>
<td class="dxrpLE">
                        <div style="font-size:1px;"></div>
                    </td>
                    <td id="rndPanel_RPC" class="dxrp dxrpcontent" width="100%" style="padding-padding-right:11px;padding-padding-bottom:10px;">
                        <table>
                            <tr>
                                <td colspan="2">
                                    <img src="imagenes/logoOPTI.png" alt="Dirección de Operaciones y Tecnología" width="236px" height="180px"/><br
 /><br />
                                </td>
                            </tr>
                            <tr>
                                <td>Usuario:</td>
                                <td>
                                    <table class="dxeTextBoxSys dxeTextBox_Office2010Silver" cellspacing="0" cellpadding="0" id="rndPanel_txtUserName"
 width="100%">
               <tr>
               <td class="dxic" width="100%">
                                                <input class="dxeEditArea_Office2010Silver dxeEditAreaSys" id="rndPanel_txtUserName_I"
 name="rndPanel$txtUserName" onfocus="aspxEGotFocus('rndPanel_txtUserName')" onblur="aspxELostFocus('rndPanel_txtUserName')" onkeydown="aspxEKeyDown('rndPanel_txtUserName', event)"
 onkeyup="aspxEKeyUp('rndPanel_txtUserName', event)" type="text" />
                                            </td>
               </tr>
               </table>                
                                </td>
                            </tr>
                            <tr>
                                <td>Contraseña:</td>
                                <td>
                                    <table class="dxeTextBoxSys dxeTextBox_Office2010Silver" cellspacing="0" cellpadding="0" id="rndPanel_txtPassword"
 width="100%">
               <tr>
               <td class="dxic" width="100%">
                                                <input class="dxeEditArea_Office2010Silver dxeEditAreaSys" id="rndPanel_txtPassword_I"
 name="rndPanel$txtPassword" onfocus="aspxEGotFocus('rndPanel_txtPassword')" onblur="aspxELostFocus('rndPanel_txtPassword')" onkeydown="aspxEKeyDown('rndPanel_txtPassword', event)"
 onkeyup="aspxEKeyUp('rndPanel_txtPassword', event)" type="password" />
                                            </td>
               </tr>
               </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <table cellspacing="0" cellpadding="0" id="rndPanel_btnEntrar" width="100%" style="border-collapse:separate;">
               <tr>
               <td id="rndPanel_btnEntrar_B" class="dxbButton_Office2010Silver" align="center">
                                                <div id="rndPanel_btnEntrar_CD" class="dxb">
                   <table cellspacing="0" cellpadding="0" style="border-collapse:separate;">
                   <tr>
                   <td style="padding-right:4px;">
                                                                <img id="rndPanel_btnEntrar_BImg"
 src="imagenes/login.png" alt="" />
                                                            </td>
                                                            <td id="rndPanel_btnEntrar_BTC" class="dxb">
                                                                <span>Entrar</span>
                                                            </td>
                   </tr>
                   </table>
                   </div>
                                            </td>
                                            <td width="0%">
                                                <input value="" onfocus="aspxBGotFocus('rndPanel_btnEntrar')"
 type="submit" name="rndPanel$btnEntrar" border="0" style="padding:0px;" />
                                            </td>
               </tr>
               </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <input type="hidden" id="rndPanel_popupLoginWS" name="rndPanel_popupLoginWS" value="0:0:-1:-10000:-10000:0:250px:-10000:1:0:0:0"
 />
                                        <div id="rndPanel_popupLogin_PW-1" style="display:none;">
                   <table id="rndPanel_popupLogin_PWST-1" cellspacing="0" cellpadding="0" style="border-collapse:separate;">
                   <tr>
                   <td class="dxpcControl_Office2010Silver" onmousedown="aspxPWMDown(event,'rndPanel_popupLogin',-1,false)"
 width="250" style="cursor:default;"><table id="rndPanel_popupLogin_CLW-1" cellspacing="0" cellpadding="0" width="250" style="border-collapse:separate;">
                   <tr>
                   <td id="rndPanel_popupLogin_PWH-1" class="dxpcHeader_Office2010Silver" style="padding-padding-right:2px;padding-padding-bottom:2px;">
                                                                <table cellspacing="0"
 cellpadding="0" width="100%" style="border-collapse:separate;">
                       <tr>
                       <td class="dxpc" width="100%">
                                                                        </td>
                                                                        <td
 class="dxpcHBCell_Office2010Silver dxpcHBCellSys">
                                                                         
   <table cellspacing="0" cellpadding="0" style="border-collapse:separate;">
                           <tr>
                           <td id="rndPanel_popupLogin_HCB-1" class="dxpcCloseButton_Office2010Silver"
 onclick="aspxPWCBClick(event, 'rndPanel_popupLogin',-1)" onmousedown="return aspxPWHMDown(event);" style="cursor:pointer;">
                                                                         
               <img id="rndPanel_popupLogin_HCB-1Img" class="dxWeb_pcCloseButton_Office2010Silver" src="/Archivero/DXR.axd?r=1_10-eIuD8" alt="[Close]" title="" />
                                                                         
           </td>
                           </tr>
                           </table>
                                                                        </td>
                       </tr>
                       </table>
                                                            </td>
                   </tr>
                                                        <tr>
                   <td id="rndPanel_popupLogin_PWC-1" class="dxpcContent_Office2010Silver" style="border-top-width:0px;">
                                                                <div id="rndPanel_popupLogin_CSD-1"
 class="dxpcContentPaddings_Office2010Silver">
                       <div> 
La idea es agregar el usuario y la contraseña a los campos rndPanel_txtUserName y rndPanel_txtPassword y ejecutar el evento del botón rndPanel_popupLoginWS.

Alguien puede apoyarme.

Saludos.

Etiquetas: asp, aspx, inicio, sesión
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:57.