Application_BeginRequest and Request.Params[] under Asp.net 2.0

Discussion in 'ASP .Net' started by tao lin, Mar 24, 2006.

  1. tao lin

    tao lin Guest

    Hi, all

    I am using VS 2005 under windows 2000.

    I just upgrade my asp.net app from 1.1 to 2.0. And I found a very strange
    proglem in my Global.asax.cs's Application_BeginRequest function, here is my
    code:

    protected void Application_BeginRequest(Object sender, EventArgs e) {

    if (Request.Params["client"] != null)

    this.Context.Items.Add("ClientCode", Request.Params["client"]);

    else

    throw(new NullClinetException());

    ......

    }

    In my Asp.net 1.1, everything works fine. But after I upgraded to Asp.net
    2.0, when I input my query string like this:

    http://localhost/MyWeb/DesktopDefault.aspx?client=PT&tabindex=1&tabid=10

    It raise the follow exception:

    NullClinetException: System error.
    at PaperTiger.Global.Application_BeginRequest(Object sender, EventArgs e)
    in c:\Projects\\MyWeb\App_Code\Global.asax.cs:line 117
    at
    System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication
    ..IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
    completedSynchronously)

    Is there anything changed between Asp.net 1.1 and 2.0, and I need to modify
    my code?

    Cheers,

    Tao
    tao lin, Mar 24, 2006
    #1
    1. Advertising

  2. Comment out the line:
    throw(new NullClinetException());

    Not only is this misspelled, but I am not sure if such an animal as
    "nulclientException" exists, unless its a custom class of your.
    Peter


    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "tao lin" wrote:

    > Hi, all
    >
    > I am using VS 2005 under windows 2000.
    >
    > I just upgrade my asp.net app from 1.1 to 2.0. And I found a very strange
    > proglem in my Global.asax.cs's Application_BeginRequest function, here is my
    > code:
    >
    > protected void Application_BeginRequest(Object sender, EventArgs e) {
    >
    > if (Request.Params["client"] != null)
    >
    > this.Context.Items.Add("ClientCode", Request.Params["client"]);
    >
    > else
    >
    > throw(new NullClinetException());
    >
    > ......
    >
    > }
    >
    > In my Asp.net 1.1, everything works fine. But after I upgraded to Asp.net
    > 2.0, when I input my query string like this:
    >
    > http://localhost/MyWeb/DesktopDefault.aspx?client=PT&tabindex=1&tabid=10
    >
    > It raise the follow exception:
    >
    > NullClinetException: System error.
    > at PaperTiger.Global.Application_BeginRequest(Object sender, EventArgs e)
    > in c:\Projects\\MyWeb\App_Code\Global.asax.cs:line 117
    > at
    > System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication
    > ..IExecutionStep.Execute()
    > at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
    > completedSynchronously)
    >
    > Is there anything changed between Asp.net 1.1 and 2.0, and I need to modify
    > my code?
    >
    > Cheers,
    >
    > Tao
    >
    >
    >
    >
    >
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Mar 26, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Bass
    Replies:
    2
    Views:
    3,708
    dave wanta
    Jul 4, 2003
  2. Franck
    Replies:
    1
    Views:
    482
    Karl Seguin
    Oct 4, 2005
  3. Rahul
    Replies:
    0
    Views:
    489
    Rahul
    May 11, 2006
  4. Franck
    Replies:
    0
    Views:
    146
    Franck
    Sep 30, 2005
  5. Barry
    Replies:
    9
    Views:
    443
    Ara.T.Howard
    Sep 15, 2005
Loading...

Share This Page