10 Replies - 16675 Views - Last Post: 27 March 2012 - 11:40 PM

#1 djlakshmi   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

auto login into a asp.net website

Posted 31 March 2010 - 10:27 PM

hi,
i ve tried to auto login into an asp.net website. using javascript i can automatically log in to the www.irctc.co.in website but the same code have not worked for the website i ve tried. it have not even fill the username and password in the required filed. it just taken me to the login page of that website. the code i ve used is
<html>
<head>

<script type="text/javascript">

function autoLogin() {
document.webservices.submit();
} 
</script>

</head>

<a href="javascript<b></b>:autoLogin()">Log me automatically in</a>

<BODY>
<form name="webservices" method=post action="https://www.irctc.co.in/cgi-bin/bv60.dll/irctc/services/login.do" target="new_window" onsubmit="window.open('', 'new_window', 'width=450,height=300,status=yes,resizable=yes,scrollbars=yes)"> 
<input type=hidden id=UserName name="userName" value="xxxxxx"></input> 
<input type=hidden id=Password name="password" value="yyyyyy"></input> 
</form>

</body>
</html>



i dont know where i am wrong. pls correct me.

This post has been edited by djlakshmi: 31 March 2010 - 10:31 PM


Is This A Good Question/Topic? 0
  • +

Replies To: auto login into a asp.net website

#2 eclipsed4utoo   User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1536
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: auto login into a asp.net website

Posted 01 April 2010 - 04:59 AM

Moving to the Javascript forum.
Was This Post Helpful? 0
  • +
  • -

#3 jrm402   User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 333
  • Joined: 18-March 10

Re: auto login into a asp.net website

Posted 01 April 2010 - 08:15 AM

I would look into setting cookies when the user logs in and wants to be remembered. Than you can reference that.
Was This Post Helpful? 0
  • +
  • -

#4 djlakshmi   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

Re: auto login into a asp.net website

Posted 07 April 2010 - 10:00 PM

View Postjrm402, on 01 April 2010 - 07:15 AM, said:

I would look into setting cookies when the user logs in and wants to be remembered. Than you can reference that.


thanks for ur reply,
but i dont have idea about cookies.. so can u explain in detail about what it is and how and where to use cookies..



thanks in advance
Was This Post Helpful? 0
  • +
  • -

#5 djlakshmi   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

Re: auto login into a asp.net website

Posted 08 April 2010 - 02:15 AM

hello guys,


actually i ve got this url when i made google search for "autologin into asp.net website". i can understand the concept they ve explained. but i dont know which language they have mentioned [whether it is c# or asp.net]. and how to implement that code.
so anybody pls go through the link below.

http://www.byteblock...WebRequest.aspx

it would be very helpful for my project if u go through it and explain me how and where to implement it.
expecting fast replies guys since im in urge to complete my project soon. pls..

Thanks in advance.
Was This Post Helpful? 0
  • +
  • -

#6 psyking   User is offline

  • D.I.C Head
  • member icon

Reputation: 20
  • View blog
  • Posts: 173
  • Joined: 17-January 10

Re: auto login into a asp.net website

Posted 10 April 2010 - 12:43 AM

asp.net is not a language. For an asp.net website you can use the regular website languages (i.e. HTML, Javascript, CSS, etc.), as well as C# and VB.net.
Was This Post Helpful? 0
  • +
  • -

#7 djlakshmi   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

Re: auto login into a asp.net website

Posted 11 April 2010 - 11:14 PM

k psyking,

i asked how can i use those things u mentioned here. i gave the code i ve tried it does not help me.. atleast u help me pls..


expecting ur reply.
Was This Post Helpful? 0
  • +
  • -

#8 djlakshmi   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

Re: auto login into a asp.net website

Posted 14 April 2010 - 02:51 AM

hello experts,


im repeatedly writing hre myself just to draw ur attention towards this thread..

the task seems hard for me since im new.. but experts feel easy to solve this na..

then y r u not ready to show ur interest and share ur knowledge here.

it will help people like me..

so do help..


thanks.
Was This Post Helpful? 0
  • +
  • -

#9 psyking   User is offline

  • D.I.C Head
  • member icon

Reputation: 20
  • View blog
  • Posts: 173
  • Joined: 17-January 10

Re: auto login into a asp.net website

Posted 14 April 2010 - 02:04 PM

What you could do is find out the page that logs the user in, since it is an aspx page, you would probably want to find out what page the code for the logging in part happens. Then supply the variables needed.

Take a regular web site. It has 5 pages. 1 of those pages causes the server to recognize that you are logged in. You would need to link to this page. You could do so like this:
<form method="post" action="login.aspx">
     <input type="hidden" name="usrnm" value="Your Username" />
     <input type="hidden" name="passwd" value="Your Password" />
     <input type="submit" value="Log in to site" />
</form>


You have to click the button, otherwise it won't go through with the action. You would have to change the names, action and values for it to work.

The downside to this is that it will be visible in the sourcecode to anyone interested in finding out what the username and password is.
Was This Post Helpful? 0
  • +
  • -

#10 djlakshmi   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

Re: auto login into a asp.net website

Posted 14 April 2010 - 09:23 PM

hello,

i ve achieved my task via C#.. It gets login into my clients site automatically or programmatically..

Thank u for ur guidance and interest..


good day.
Was This Post Helpful? 0
  • +
  • -

#11 dhirajgautame   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-March 09

Re: auto login into a asp.net website

Posted 27 March 2012 - 11:40 PM

View Postdjlakshmi, on 14 April 2010 - 09:23 PM, said:

hello,

i ve achieved my task via C#.. It gets login into my clients site automatically or programmatically..

Thank u for ur guidance and interest..


good day.



Hi djlakshmi,

I have same requirement. i wrote following code

 SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorer();
            IWebBrowserApp wb = (IWebBrowserApp)ie;
            wb.Visible = true;
            //Do anything else with the window here that you wish
            wb.Navigate(ProductLoginURL, ref o, ref o, ref o, ref o);

            while (ie.Busy)
            {
                System.Threading.Thread.Sleep(500);
            }
            mshtml.DispHTMLDocument doc = ie.Document as mshtml.DispHTMLDocument;
            doc.getElementById(UserNameTagID).setAttribute("value", UserName);
            doc.getElementById(PasswordTagID).setAttribute("value", Passowrd);
            doc.getElementById(SignInTagID).click();


it is running ok on Development Server when i deployed on Server this site it giving Following Error

Retrieving the COM class factory for component with CLSID {0002DF01-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). 


can u give me your code or Guide what you manipulate this code. thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1