Archive for the ‘ASP.NET’ Category

Get Max Request length from web.config

नोव्हेंबर 3, 2009

For retrieving maxrequest length from web.config use following function:

public int GetMaxLength()
{
HttpRuntimeSection httpRuntime =
(HttpRuntimeSection)ConfigurationManager.GetSection("system.web/httpRuntime");
return httpRuntime.MaxRequestLength;
}

Convert Arraylist to String Array in VB.NET

ऑगस्ट 20, 2009

Dim data As new ArrayList()
Dim str() As String = data.ToArray(GetType(String))

Major JavaScript Objects and Functions

जानेवारी 24, 2009

Here are some of the Javascript objects and their properties & methods

Hierarchy Objects
Object Properties Methods Event Handlers
Window defaultStatus
frames
opener
parent
scroll
self
status
top
window
alert
blur
close
confirm
focus
open
prompt
clearTimeout
setTimeout
onLoad
onUnload
onBlur
onFocus
Frame defaultStatus
frames
opener
parent
scroll
self
status
top
window
alert
blur
close
confirm
focus
open
prompt
clearTimeout
setTimeout
none (The onLoad and onUnload event handlers belong to the Window object)
Location hash
host
hostname
href
pathname
por
protocol
search
reload
replace
none
History length
forward
go
back none
Navigator appCodeName
appName
appVersion
mimeTypes
plugins
userAgent
javaEnabled none
document alinkColor
anchors
applets
area
bgColor
cookie
fgColor
forms
images
lastModified
linkColor
links
location
referrer
title
vlinkColor
clear
close
open
write
writeln
none (the onLoad and onUnload event handlers belong to the Window object.
image border
complete
height
hspace
lowsrc
name
src
vspace
width
none none
form action
elements
encoding
FileUpload
method
name
target
submit
reset
onSubmit
onReset
text defaultValue
name
type
value
focus
blur
select
onBlur
onCharge
onFocus
onSelect
Built-in Objects
Array length join
reverse
sort xx
none
Date none getDate
getDay
getHours
getMinutes
getMonth
getSeconds
getTime
getTimeZoneoffset
getYear
parse
prototype
setDate
setHours
setMinutes
setMonth
setSeconds
setTime
setYear
toGMTString
toLocaleString
UTC
none
String length
prototype
anchor
big
blink
bold
charAt
fixed
fontColor
fontSize
indexOf
italics
lastIndexOf
link
small
split
strike
sub
substring
sup
toLowerCase
toUpperCase
Window
JavaScript Rocks!!

you can use javascript on asp.net form just by adding

<script language=”JavaScript”>
</script>

tag in the <head> of the asp.net page,

Between <script language=”JavaScript”> </script> tag you can declare your javascript function and then call it.

Refreshing page in asp.net

जानेवारी 19, 2009

Response.redirect(Request.url.ToString)

Failed to access IIS metabase

डिसेंबर 16, 2008

Today i installed IIS on my Machine, I already installed visual studio 2005,

I tried to deploy my application to the iis server, i was getting the error “Failed to access IIS metabase”,

I searched on MICROSOFT site and got the solution of the problem.

To resolve the problem:

Go to Start=>Run
type “cmd” (of course without double quotes)
type “cd C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin”

type “aspnet_regiis -i”

press ENTER

you’ll see something like:
“Start installing ASP.NET (2.0.50727).
……………..”

wait for a while, and you’ll see

“Finished installing ASP.NET (2.0.50727).”

that’s all,

I deployed my project and it worked fine!!

JAI MAHARASHTRA

Embedding ASP.NET page into another page

डिसेंबर 16, 2008

First import System.IO and System.Net into the codebehind file of the page.

Take a label on the page say Label1.

add following function to the class:-

Private Function GetPageOutput(ByVal url As String) As String

Dim wr As WebRequest = WebRequest.Create(url)

Dim sr As StreamReader = New StreamReader(wr.GetResponse().GetResponseStream())

Return sr.ReadToEnd()

End Function

Take a button say Button1, in click event of Button1

call the PageOutput function as

Label1.Text=PageOutput(“http://www.google.com“)

finished, The child page content will be embeded into the current page