Results 1 to 4 of 4

Thread: Collecting GET variable in Global.ascx?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    10

    Collecting GET variable in Global.ascx?

    Greetings All, I want to collect a quesrystring parameter (HTTP GET variable) in the global.ascx file (either in application start or session start) Is this possible? I.E. in GLOBAL.ascx under the APPLICATION_START event, put a piece of code that collects the parameter using
    request.params("paramtername")?

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    10

    Re: Collecting GET variable in Global.ascx?

    Ok I figured it out... moved my request from Application_Start, to Application_BeginRequest and it handled it. Was just a matter of me realizing when these events fire!!

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Collecting GET variable in Global.ascx?

    I'm interested in knowing what code you used. Can you paste it here?

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    10

    Re: Collecting GET variable in Global.ascx?

    Here ya go, bascially Im populating a hashtable to hold the settings for a site based on the querysting in the url. This is done to spawn multiple sites from a single backend SQL database where layout values are held.

    VB Code:
    1. Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
    2.  
    3. 'Gets the querystring value and holds it in a public shared variable
    4. VB.CorpID = Request.Params("CorpID")
    5.  
    6. 'if the variable isn't zero then do something
    7.             If VB.CorpID <> 0 Then
    8.  
    9.                 VB.SiteTable = VB.LoadConfig(VB.CorpID)
    10.  
    11.                 End If
    12.             Else
    13.                 'TODO: Insert Redirection to Error Page Here
    14.                 Throw New HttpException(404, "not found")
    15.             End If
    Last edited by mlynch3261; Apr 4th, 2005 at 10:40 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width