Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Tuesday, August 4, 2009

How to get Current Page Url

in asp sometime we required current page URL, if u r using JavaScript then u can easily get it by using location.href or one way is HTTP_REFEREL but it will give you Previous page name

now look at here how we can get the Current page URL


< %

function pageurl()

serverName = Request.ServerVariables("SERVER_NAME")
ScriptName = Request.ServerVariables("SCRIPT_NAME")

if Request.ServerVariables("HTTPS") = "on" then secure = "s"

prt = strleft(LCase(Request.ServerVariables("SERVER_PROTOCOL")), "/") & secure

if Request.ServerVariables("SERVER_PORT") = "80" then
port = ""
else
port = ":" & Request.ServerVariables("SERVER_PORT")
end if

pageurl = prt & "://" & serverName & port & ScriptName

end function

%>


Here is a function which will generate pageurl to call this use


<% response.write (pageurl) %>


if page had Querystring you can also retrive that like this


< %
Qstring = Request.ServerVariables("QUERY_STRING")
response.write(pageurl() & "?" & Qstring )
% >


hope it will helps you.

Friday, July 24, 2009

File upload using ASP

while designing web form (like client Registration) we required some upload kind of
control ,for that here is a best example to do this

here u can upload (text file , image , pdf , video) and all

steps

1. open config.inc file and set the path from where u want to access file

strFolder = "C:\upload\files"
2. Specify the file size , 0 will give unlimited file size
lngFileSize = 10000

3.if you want to excluded the specify the files to be excluded and must be set to blank ("") if none are to be excluded
strExcludes = ""

4. if you want to include file then specify the file extension to be allowed
strIncludes = ".gif;.jpg;.mp3"


here is the complete source code of file upload