Posts Tagged ‘VB.NET’

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;
}

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