Pages

Thursday, May 30, 2013

E-MAIL HACKING USING HTML

For making an e-mail hacking page or id you have to write an html script like this :-

mail( )

<?php

$to='nobody@example.com';                          ("your website")

$subject='the subject';

$message='hello' ;                                  ("or anything you want to write" )

$headers='from:webmaster@example.com'."\r\n".

'reply-to:webmaster@example.com'."\r\n".

'x-mailer:php/'.phversion( );

mail($to,$subject,$message,$headers);

?>

    Now you can create a web page for hacking an email address or for sending fake mails to persons.
    There is an another way to register a single e-mail id many times :-
    An email id does not recognize these symbols or it does not use them but  for registration it isacted
    as a new email address with "." (dot) or you can use many symbols but i think ' . ' (dot) symbol is more
    preferred so enjoy email spamming.

Monday, May 27, 2013

Postback and Autopostback in asp.net

ispostback=true -page is being loaded in response to a client postback.
ispostback=false -the page is loaded for the first time.

A postback is initiated by the browser, and reloads the whole page, usually when a control on the page (e.g. a button) is changed.
With some controls (e.g. Checkboxes), you choose if changing the control should result in a postback. This property is called AutoPostback.
A callback is initiated by java script in the page, and can load/update parts of the page, e.g. by manipulating the DOM

 Note:

AutopostBack posts the page to the server automatically whenever some changes is done in that controls data. Like Textbox text is changed it is automatically posted to server.
Dropdownlist selected value changed.

IsPostBack is used to check page is loaded for the first time or is reloaded. eg:
if page is loaded for first time we enter the value in dropdownlist from database. If the page is reloaded we are not going to enter that value again. So we check for
IsPostBack condition

what is formatted output in asp.net

Here Response.Write():to display only string and you can not display any other data type values like int,date,etc.Conversion(from one data type to another) is not allowed.
 whereas Response .Output .Write(): you can display any type of data like int, date ,string etc.,by giving index values.
Sample code:
protected void Button1_Click(object sender, EventArgs e)
{
 Response.Write ("hi good morning!"+"is it right?");//only strings are allowed        
 Response.Write("Scott is {0} at {1:d}", "cool", DateTime.Now);//this will give 
       //error(conversion is not allowed)
 Response.Output.Write("\nhi goood morning!");//works fine
 Response.Output.Write("Jai is {0} on {1:d}", "cool", DateTime.Now);//here the
       // current date will be converted into string and displayed
}

difference between Server.Redirect and Response.Redirect?

server.transfer:- there is no round trip .it is directly go to the server but
response.redirect :-In response.redirect round trip is there .

roundtrip means :- request and response (the complete cycle is called round trip )


what is response.redirect in asp.net?

Ans:A web page sometimes changes locations. It is important to redirect the old address to the new one. This makes links pointing to the old address still work

 

Sample code: 

<asp:Button ID="btn" runat="Server" Text="SUBMIT"/>protected void btnNewEntry_Click(object sender, EventArgs e){
    Response.Redirect("newpage.aspx");}

What is server software and what does it do?

Server Software is used by web developers mainly. It's software that allows web developers to add more web pages to their websites with ease; without the software it would be a pain trying to add another web page to an already made website. The software works through a process known as FTP (file transfer protocol) this process uploads web pages directly onto a website without any hassle

know your browse name and verson using asp pg

ASP.CS code
protected void page-load(---)
 {
   HttpBrowsercapabilites b=Request.Browser;
   Response.write(b.Browser+"<br>");
   Response.write(b.version);
   Response.write(b.type);
   Response.write(b.Request.URL);
  DateTime dt=( Response.Requestcontent.Httpcontext).Timestamp;
}

Node:  Remember u must write a text box and a button for getting outpu

how browser know which button you submit?

Ans:

In side the HTML code ,there is a file called "Event handler"

PAGE LIFE CYCLE METHOD IN ASP.NET

Types of life cycle
1.page-preInit method
2.page-Init method
3.page-load method
4.postback event method
5.page-prerender method
6.Render method
7.unload method
8.save viewstate method
9.load view style

1.page-preInit method:

 In this method we can change the master page dynamically.

2.page-Init method:

 In this method page control Id  properties will be initialize.

3.page-load method:

 In this method all remaining properties of  page control will be initialize.

4.postback event method:

 This method will be executed only during postback(when user click on the button in the client side)

5.Render method:

 Render method is responsible for convert asp.net contorl code(html server side control ) into equivalent html code 


 
 

how to change button color in asp

how to change your color putting your require color:

ASPX Code:

Put ur rwqured color:<asp:TextBox id="tbx" runat="server">
<asp:button id="btn" runat="server">

ASPX.CS Code:

using.system.Drawing;

{
  string clr=tbx.Text;
  btn.backcolor=color.FromName(clr);
}

complete lifecycle of a Web page.

When we execute a Web page, it passes from the following stages, which are collectively known as Web page lifecycle:
  • Page request - During this stage, ASP.NET makes sure the page either parsed or compiled and a cached version of the page can be sent in response
  • Start - During this stage sets the Request and Response page properties and the page check the page request is either a postback or a new request
  • Page Initialization - During this stage, the page initialize and the control's Unique Id property are set
  • Load - During this stage, if the request is postback, the control properties are loaded without loading the view state and control state otherwise loads the view state
  • Validation - During this stage, the controls are validated
  • Postback event handling - During this stage, if the request is a postback, handles the event
  • Rendering - During this stage, the page invokes the Render method to each control for return the output
  • Unload - During this stage, when the page is completely rendered and sent to the client, the page is unloaded.

Sunday, May 26, 2013

ASP.NET interview questions and answers

1.What is ASP.NET?
Ans:
ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
->ASP.NET provides increased performance by running compiled code.
->In asp.net all the page inherit from "page" class p but c#  "object"/
->In asp.net must of the time IIS server execute.
->In  asp.net micrisoft provide a server is called "asp.net server".

2.How to write code in asp.net.

Ans:
 Name<asp:TextBox ID="name" runat="server"> // for textbox
<asp:Button ID="Button1" runat="server"Text="Submit" /> // for button
state: <asp:DropDownList ID="ddlStates" runat ="server"> // for dropdownlist
     <asp:ListItem>---select state--- </asp:ListItem>
     <asp:ListItem>Odisha</asp:ListItem>
     <asp:ListItem>karnataka</asp:ListItem>
     </asp:DropDownList>
<asp:listBox ID="idname" runat="server" selection mode="multiple"> //for listbox

3. How can we identify that the Page is Post Back?
Ans: Page object has an "IsPostBack" property, which can be checked to know that is the page posted back
4.In which event are the controls fully loaded?
Ans:Page load event guarantees that all controls are fully loaded.

5. Which is the parent class of the Web server control?
Ans:The System.Web.Ul.Control class is the parent class for all Web server controls.

6.What is the code behind feature of ASP.NET?
The code behind feature divides ASP.NET page files into two files where one defines the user interface (.aspx), while the other contains all of the logic or code (.aspx.cs for C# and .aspx.vb for VB.NET). These two files are glued together with page directives like the following line, which ties the page to the specific code behind class.
<%@ Page language="c#" Codebehind="UICode.cs" Inherits="Library.UICode" %>.

7.What is a web.config file? Machine.config? 

The web.config is the basic configuration file for ASP.NET applications. It utilizes an XML format. It is used to define application settings, connection strings, and much more. These files can appear in multiple directories, and they are applied in a top-down approach. 
8.
8. What’s the use of Response.Output.Write()? 
We can write formatted output  using Response.Output.Write().

9. What is the difference between Server.Transfer and Response.Redirect?  
In Server.Transfer page processing transfers from one page to the other page without making a round-trip back to the client’s browser.  This provides a faster response with a little less overhead on the server.  The clients url history list or current url Server does not update in case of Server.Transfer.
Response.Redirect is used to redirect the user’s browser to another page or site.  It performs trip back to the client where the client’s browser is redirected to the new page.  The user’s browser history list is updated to reflect the new address.

10. What are the different Session state management options available in ASP.NET?

 In-Process
 Out-of-Process.

In-Process stores the session in memory on the web server.

Out-of-Process Session state management stores data in an external server.  The external server may be either a SQL Server or a State Server.  All objects stored in session are required to be serializable for Out-of-Process state management.

11.Define authentication and authorization.

Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication.
Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

12.Which method do you use to redirect the user to another page without performing a round trip to the client?


Ans:

    Server.Transfer  // for outside
    Server.Execute //inside application(main ans)

13. What is the use of PlaceHolder control? Can we see it at runtime?


The PlaceHolder control acts as a container for those controls that are dynamically generated at runtime. We cannot see it at runtime because it does not produce any visible output. It used only as a container.

14.What are the event handlers that can be included in the Global.asax file?

The Global.asax file contains some of the following important event handlers:

    Application_Error
    Application_Start
    Application_End
    Session_Start
    Session_End

14. How can you dynamically add user controls to a page?


User controls can be dynamically loaded by adding a Web User Control page in the application and adding the control on this page.

15.What events are fired when a page loads?The following events fire when a page loads:

    Init() - Fires when the page is initializing.
    LoadViewState() - Fires when the view state is loading.
    LoadPostData() - Fires when the postback data is processing.
    Load() - Fires when the page is loading.
    PreRender() - Fires at the brief moment before the page is displayed to the user as HTML.
    Unload() - Fires when the page is destroying the instances of server controls.

16.What is a web server?

Ans :A web server delivers requested web pages to users who enter the URL in a web browser.


How you can disable session?

Ans: If we set session Mode="off" in web.config, session will be disabled in the application. For this, we need to configure web.config the following way:
<configuration>
  <sessionstate  Mode="off"/>
</configuration>


9).What are Session Events?
Ans: There are two types of session events available in ASP.NET:
Session_Start
Session_End.

What are the components of ADO.NET?

The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection.

What are the different types of cookies in ASP.NET?


Session Cookie – Resides on the client machine for a single session until the user does not log out.

Persistent Cookie – Resides on a user’s machine for a period specified for its expiry, such as 10 days, one month, and never.

How we can force all the validation controls to run?


The Page.Validate() method is used to force all the validation controls to run and to perform validation.
 

Saturday, May 25, 2013

javascript validations

There are six main types of validation controls:- 

1.RequiredFieldValidator: It checks whether the control have any value. It's used when you want the control should not be empty.

2.RangeValidator: It checks if the value in validated control is in that specific range.

3.CompareValidator: It checks that the value in controls should match the value in other control.

4.RegularExpressionValidator: When we want the control value should match with a specific regular expression.

5.CustomValidator: It is used to define UserDefined validation.

6.ValidationSummary: It displays summary of all current validation errors.

Code for RequiredFieldValidator:

  <script type='text/javascript'>
   function notEmpty(elem, helperMsg)
   {
    if(elem.value.length == 0)
       {
        alert(helperMsg);
        elem.focus();
        return false;
        }
    return true;
}
</script>
<form>
Required Field: <input type='text' id='req1'/>
<input type='button'
    onclick="notEmpty(document.getElementById('req1'), 'Please Enter a Value')"
    value='Check Field' />
</form>



Form Validation - Checking for All Numbers:

 <script type='text/javascript'>
function notEmpty(elem, helperMsg)

     {
    if(elem.value.length == 0)

       {
        alert(helperMsg);
        elem.focus();
        return false;
      }
    return true;
}
</script>
<form>
Required Field: <input type='text' id='req1'/>
<input type='button'
    onclick="notEmpty(document.getElementById('req1'), 'Please Enter a Value')"
    value='Check Field' />
</form>

Form Validation - Checking for All Letters:

 <script type='text/javascript'>
function isAlphabet(elem, helperMsg)
{
var alphaExp = /^[a-zA-Z]+$/;
if(elem.value.match(alphaExp))
   {
     return true; 
   }
   else
   {
      alert(helperMsg);
      elem.focus();
      return false;
    }
}
</script>
<form>
Letters Only: <input type='text' id='letters'/>
<input type='button' 
onclick="isAlphabet(document.getElementById('letters'), 'Letters Only Please')"
 value='Check Field' />
</form>

 Note: if u want both number and char then write like var alphaExp = /^[0-9a-zA-Z]+$/;

Form Validation - Restricting the Length:

 <script type='text/javascript'>
function lengthRestriction(elem, min, max)
    {
  var uInput = elem.value;
  if(uInput.length >= min && uInput.length <= max)
      {
    return true;
      }
     else
       {
    alert("Please enter between " +min+ " and " +max+ " characters");
    elem.focus();
    return false;
    }
}
</script>
<form>
Username(6-8 characters): <input type='text' id='restrict'/>
<input type='button'
onclick="lengthRestriction(document.getElementById('restrict'), 6, 8)"
    value='Check Field' />
</form>

 Form Validation - Email Validation:

 <script type='text/javascript'>
function emailValidator(elem, helperMsg)
   {
     var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
     if(elem.value.match(emailExp))
        {
      return true;
    }
      else
        {
       alert(helperMsg);
       elem.focus();
       return false;
    }
}
</script>
<form>
Email: <input type='text' id='emailer'/>
<input type='button'
 onclick="emailValidator1(document.getElementById('emailer'), 'Not a Valid Email')"
    value='Check Field' />
</form>

JavaScript fundamentals questions with answers?

JavaScript is a Scripting Language.A scripting language is a lightweight programming language.
->It is a client side scripting language.
->javascript is a object based scripting langauge.
->Java script supported 
 data type(DT), variable, if else ,else if, for, while,do while,switch,operation .function, array,object
->Java script is a loosely typed program(did not take any data type like int,bool,char)
->var is used to over come this
Note: class .inheritance,polymorphisim...etc not supported.

Where you write java script in html page?

Ans:
<html>
<head>
<script language="JavaScript" type="text/JavaScript">
-----
------
------
------
</script>
</head>
</html>

write a program add two number using java script?

ans:
<html>
<head>
 <script language="JavaScript" type="text/JavaScript">
 var v4=10;   //global variable
 Function fnadd(v1,v2)
{
  var v3=v1+v2;
  return v3;
}
Function fnsub(v5,v6)
  var v7=v5-v6;
 return v7;
}
</script>
</head>

write a program add two number  and print using java script?

<html>
<head>
 <script language="JavaScript" type="text/JavaScript">
 var v4=10;   //global variable
 Function fnadd(v1,v2)
{
  var v3=v1+v2;
  return v3;
}
Function fnadd()
{
 var res=f1(2,3);
document.write(res);
alert(res);
}
</script>
</html>

Creating Array using java script 

<script language="JavaScript" type="text/JavaScript">
var sname=new array();
 sname[0]="ritesh";
 sname[1]="rakesh";
 sname[2]="sss";
 sname[3]="shakti";
Function fnprint()
{
   debugger;   // its like break point(but we have to setting in browser[tool-internet-option-advance- disable -                          //script  debug chose internet option)
  for(i=0; i<sname.length;i++)
{
  alert(sname[i]);
}
</script>

Creating JavaScript Objects

<script>
var person=new Object();
person.firstname="John";
person.lastname="Doe";
person.age=50;
person.eyecolor="blue";
document.write(person.firstname + " is " + person.age + " years old.");
</script>

If...else Statement

<script>
function myFunction()
{
var x="";
var time=new Date().getHours();
if (time<20)
  {
  x="Good day";
  }
else
  {
  x="Good evening";
  }
document.getElementById("demo").innerHTML=x;
}
</script>

If...else if...else Statement

if (time<10)
  {
  x="Good morning";
  }
else if (time<20)
  {
  x="Good day";
  }
else
  {
  x="Good evening";
  }

 exception handling in javascript

 <!DOCTYPE html>
<html>
<head>
<script>
var txt="";
function message()
{
try
  {
  adddlert("Welcome guest!");
  }
catch(err)
  {
  txt="There was an error on this page.\n\n";
  txt+="Error description: " + err.message + "\n\n";
  txt+="Click OK to continue.\n\n";
  alert(txt);
  }
}
</script>
</head>

<body>
<input type="button" value="View message" onclick="message()" />
</body>

</html>

Friday, May 24, 2013

Cascading Style Sheets(CSS)

What is CSS?

  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML elements
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save a lot of work
  • External Style Sheets are stored in CSS files 
Note :
Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file!

How to Link HTML To CSS?

1.how to open in Visual studio: 
Ans-file -new -webpage- stylesheet(chose)
2.how to link html page to css page:
Ans-
  Css program
.Textbox         //textbox present in html page using this we r access for color or anystyle
 {
  background-color:blue
   color:red
}
.Dropdown      //same(another properties)
{
border-button-color:Green;
border-left-color:red;
border-right-color:red;
color:green;
 
Note: We cam use N nomber of properties.
         Every properties before u use dot(.)Ex: .Textbox
Sample code for how to wrtite css inside html:
<!DOCTYPE html>
<html>
<head>
<style>
body
{
background-color:#b0c4de;
}
</style>
</head>

<body>

<h1>My CSS web page!</h1>
<p>Hello world! This is a W3Schools.com example.</p>

</body>
</html>