Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
  #2 (permalink)  
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.
  #3 (permalink)  
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.
  #4 (permalink)  
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:20 PM.


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