Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2009, 03:19 AM
Registered User
 
Join Date: Jan 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default How to Create Global Subroutine or Function?

Hi,

I have the following code which I want to put into the global function/sub. But the problem is that I don't know where to put the global code and create the global function. I need the global function to be called from any .aspx page. So If any one has idea please do help me. The code i want to put into the global function is :

If Request.ServerVariables("HTTP_REFERER") <>
"http://www.abc.com/index.aspx" Then
Response.Redirect("index.html")
else
someother page

End If

Thanks in advance.
 
Old February 16th, 2009, 06:52 AM
Friend of Wrox
Points: 533, Level: 8
Points: 533, Level: 8 Points: 533, Level: 8 Points: 533, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

Check this out


http://aspnet.4guysfromrolla.com/articles/122403-1.aspx


Thank, John Bampton.
 
Old February 17th, 2009, 06:34 AM
Registered User
 
Join Date: Jan 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi John,

Thank you for you link. I went through the articles and I tried to embed my code inside the Shared Function but it gives a error with REQUEST and RESPONSE, saying 'request and response is not declare'. If you can resolve it and do immediate reply I would be very thankful to you.

Any way, thank you once more.
 
Old February 17th, 2009, 07:23 AM
Friend of Wrox
Points: 533, Level: 8
Points: 533, Level: 8 Points: 533, Level: 8 Points: 533, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

Try this

System.Web.HttpContext.Current.Request.ServerVaria bles




Similar Threads
Thread Thread Starter Forum Replies Last Post
Page 3 function versus subroutine LongJohnSilver BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1 0 January 6th, 2009 04:40 PM
Function/Subroutine Pointer Parameter pjm Access VBA 3 October 3rd, 2006 09:07 AM
how to create Global Variable VIshwastrivedi SQL Server 2000 5 September 30th, 2004 08:38 AM
How to create OledbConnection Global.asax EleaCarm ASP.NET 1.0 and 1.1 Professional 2 May 31st, 2004 08:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.