Function in

Results 1 to 2 of 2

Thread: Function in

  1. #1
    Join Date
    Dec 1969

    Default Function in

    How would I put this script inside a function in The language is C#:<BR><BR>&#060;script runat="server"&#062;<BR> void Page_Load(Object Src, EventArgs E) {<BR> if ( homepage ) {<BR> news.Text = readHtmlPage("http://wsi4:7186/intranet2/home/news.aspx/");<BR> }<BR>}<BR> private String readHtmlPage(string url)<BR> {<BR> String result;<BR> WebResponse objResponse;<BR> WebRequest objRequest = System.Net.HttpWebRequest.Create(url);<BR> objResponse = objRequest.GetResponse();<BR> using (StreamReader sr = <BR> new StreamReader(objResponse.GetResponseStream()) )<BR> {<BR> <BR> string strContent = sr.ReadToEnd();<BR> Regex regex = new Regex("&#060;!-- homeStart --&#062;((.&#124
    )*?)&#060;!-- homeEnd --&#062;",<BR> RegexOptions.IgnoreCase);<BR> Match oM = regex.Match(strContent);<BR> return oM.Value;<BR><BR> // Close and clean up the StreamReader<BR> sr.Close();<BR> }<BR> return result;<BR> } <BR> <BR>&#060;/script&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Function in

    Huh? Those are already functions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts