Hi Rune,
The problem does not lie in the scope of the Request object (actually,
it is the Page.Request property that is being accessed, and it *is*
available globally.). The problem is that your function
"returnLanguage" is static. Therefore, the Request property of the
Page instance cannot be accessed within the function. Try removing the
"static" keyword and try.
On Oct 13, 3:08 pm, Rune Smedstuen <[EMAIL PROTECTED]> wrote:
> Im new to both ASP.Net and C# and Im currently working on a homepage
> project.
>
> The Server/Request-object is causing some kind of headake for me as
> the scope seems somewhat limited. How can I access this from other
> functions or methods in the same class? Take
>
> protected void Page_Load(object sender, EventArgs e)
> {
> contentLabel.Text = returnLanguage();
> }
>
> public static string returnLanguage()
> {
> return Request.QueryString["lang"];
> }
>
> This *should* work in my eyes as the Server-object or Request-object
> should be globaly available. Is there any other workarounds on this,
> or would I need to use
>
> returnLanguage( Request.QueryString["lang"] );
>
> I know passing one little argument is no big deal, but it will be when
> I during the process change one detail in the function, and need to
> replace the argument-list for all caller functions.
>
> Any thoughts on best practice ?
>
> Best regards,
>
> Rune
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment
You may subscribe to group Feeds using a RSS Feed Reader to stay upto date
using following url
<a href="http://feeds.feedburner.com/DotNetDevelopment">
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---