Archive for the ‘VB.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))

Refreshing page in asp.net

जानेवारी 19, 2009

Response.redirect(Request.url.ToString)

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