Pages

Thursday, June 12, 2014

How to bind gridview in asp.net

In this article i will explain how to bind gridview to database in asp.net c# 


Add aspx page and drag gridview on it

bind gridview in asp.net with database



Web.config file write connectionstring



Tuesday, January 29, 2013

An error occurred on the server when processing the url. please contact the system administrator.

Resolved An error occurred on the server when processing the url. please contact the system administrator classic Asp iis
Due to iis setting the website doesnt show detailed error message which some times becomes difficult to debug

1) go to run  (press CTRL + R)
2) Type inetmgr
3) press Enter
4) Click virtual directory Tab then click Configuration button
an error occured on the server when processing the url please contact system administrator.






5) Click Debugging Tab and select Text error message to client.and click Apply and oK



an error occured on the server when processing the url please contact system administrator.

Tuesday, November 27, 2012

how to call stored procedure in asp

How to call stored procedure in classic asp --- How to execute store procedure in asp

Simple steps to call stored procedure in ASP

set con = Server.CreateObject("ADODB.Connection")
con.Open strConnect       
Set Comm = Server.CreateObject("ADODB.Command")
comm.ActiveConnection = con
comm.CommandText = "sqlstoredprocedurename"
comm.CommandType = adCmdStoredProc
comm.Parameters.Append comm.CreateParameter("ID" , adVarchar,adParamInput, 50, id)
comm.Parameters.Append comm.CreateParameter("PRODUCT", adVarchar, adParamInput,50, producttype )
comm.Parameters.Append comm.CreateParameter("ACCOUNT", adVarchar, adParamInput,100, "" )
comm.Parameters.Append comm.CreateParameter("O_Errors", adVarchar, adParamOutput,50)  'output parameters
comm.Execute


Monday, September 24, 2012

classic asp session timeout

classic asp session timeout  session object has timeout property


session TimeOut :- Returns the timeout period for a user session. The session timeout period is specified in minutes. if a user does not refresh or request a page within the timeout period the session ends. The default value of the Timeout property in iis  30 mins

syntax for session timeout

<%
session.Timeout = 30
%>

Sunday, September 2, 2012

change session id after login asp

How to change session id after login asp


Risk of not changing session id after login asp 
on accessing the application the users receive a session id which remains constant until the browser instance is used closed. An adversary can hijack session and gain unauthorized access to sensitive information

Step to change session id after login in asp

<% dim ckie1,ckie2,findcolonpos,finalckie
   ckie = Request.ServerVariables("HTTP_COOKIE")
     findcolonpos=InStr(1,ckie,";")
   if findcolonpos>0 then
                ckie1=split(ckie,";")
                ckie2=split(ckie1(1),"=")
        finalckie=ckie2(0)
        else
                ckiename = Mid(ckie,1,(Instr(ckie,"=")-1))
                finalckie=ckiename
        end if

%>
<META HTTP-EQUIV="Set-Cookie" Content="<%=finalckie%>=NULL; path=/">


just put the above code  on top of page after the user gets login to application (eg :- Welcome page)



Monday, July 23, 2012

Server object in Asp

The Asp Server Object can store user defined variables . The variables stored in the Server object are common to all the web pages on the web server. This enables the value to be the same for all the users on all the pages. The Server object contains only one property, ScriptTimeOut. You can use the property  to set the time for which a script is allowed to execute by a server , before it is stopped. For Example, you can specify :-
<% Server.ScriptTimeout  = 50   % >
The previous statement indicates it will allow scripts to run for 50 seconds. The Server will Terminate scripts after 50 seconds  and display an error message This property is useful when a Script is executing a loop with  very high values or waiting for resource to be free. By default the for Scripttimeout property is set to 90 seconds.

ASP SERVER OBJECT METHODS
Method Description
CreateObject Creates an instance of an object
Execute Executes an .asp files
URLEncode Converts a string into the proper format for HTTP paramater passing with escape characters
HTMLEncode Convers HTML string characters to be displayed on a browser instead of being interpreted
MapPath convert a virtual path to phyiscal path
Transfer Transfer control to another ASP page. It does not create a new object context
GetLastError Returns an instance of the ASPError object


Thursday, July 5, 2012

Err Objects Asp (Vbscript)

Error objects 
There are 2 error objects that you can use to handle the errors that occur while creating and executing ASP Code.
  • Err Object
  • ASPError Object 
The err object contains information about runtime errors. It is built in object provided with ASP 2.0 and works with ASP 3.0  You can use the properties of the Err object ot check for errors. For example to raise an error, you need to use the Err.Raise method with appropriate paramaters.