473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Problem with @Page RequestEncoding

Hello,
in the Web.config I have <globalization requestEncoding="utf-8"
responseEncoding="utf-8" />, but for one page I need to set the
requestEncoding="windows-1250". If I use <%@Page
RequestEncoding="windows-1250"%>, I get an error Atributte RequestEncoding is
not supported by direktive page. What is the problem?

Ondrej Srubar
Nov 19 '05 #1
8 8846
I believe CodePage="1252" is what you need to add to the specific page in
question.

In CodeBehind, you can also use the Response object to set the encoding of a
specific page. This is great when you are controlling the globalization
options programatically.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Ondrej Srubar" wrote:
Hello,
in the Web.config I have <globalization requestEncoding="utf-8"
responseEncoding="utf-8" />, but for one page I need to set the
requestEncoding="windows-1250". If I use <%@Page
RequestEncoding="windows-1250"%>, I get an error Atributte RequestEncoding is
not supported by direktive page. What is the problem?

Ondrej Srubar

Nov 19 '05 #2
In ASP.NET, System.Web.UI.Page doesn't
have a property named requestEncoding :

http://beta.asp.net/QUICKSTART/util/....UI&class=Page

What I would do, if I were you, is place that file in a
subdirectory of your application, with a web config which has :

<globalization
requestEncoding="windows-1250"
responseEncoding="windows-1250"
/>

That will give you the best of both worlds.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Ondrej Srubar" <On**********@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
Hello,
in the Web.config I have <globalization requestEncoding="utf-8"
responseEncoding="utf-8" />, but for one page I need to set the
requestEncoding="windows-1250". If I use <%@Page
RequestEncoding="windows-1250"%>, I get an error Atributte RequestEncoding is
not supported by direktive page. What is the problem?

Ondrej Srubar

Nov 19 '05 #3
Cool, but make that CodePage="1250", which is the one he wants.

Setting that CodePage would certainly set the character set to "Windows-1250",
but I'm not sure whether that would affect requestEncoding, though.

You can't set requestEncoding through the Page properties;
you can only set requestEncoding through configuration files.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM> wrote in message
news:16**********************************@microsof t.com...
I believe CodePage="1252" is what you need to add to the specific page in
question.

In CodeBehind, you can also use the Response object to set the encoding of a
specific page. This is great when you are controlling the globalization
options programatically.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Ondrej Srubar" wrote:
Hello,
in the Web.config I have <globalization requestEncoding="utf-8"
responseEncoding="utf-8" />, but for one page I need to set the
requestEncoding="windows-1250". If I use <%@Page
RequestEncoding="windows-1250"%>, I get an error Atributte RequestEncoding is
not supported by direktive page. What is the problem?

Ondrej Srubar

Nov 19 '05 #4
I need requestEncoding="windows-1250" only for one page, which takes request
from another server (i.e. I can't set encoding of a response) and I need all
other pages in utf-8 "(i.e. in the Web.config I need <globalization
requestEncoding="utf-8" responseEncoding="utf-8" />).
If I set a ContentEncoding of the request in code, the property QueryString
is already encoded by utf-8.
And the @Page doesn't have a property named requestEncoding :(

Ondrej Srubar


"Juan T. Llibre" wrote:
In ASP.NET, System.Web.UI.Page doesn't
have a property named requestEncoding :

http://beta.asp.net/QUICKSTART/util/....UI&class=Page

What I would do, if I were you, is place that file in a
subdirectory of your application, with a web config which has :

<globalization
requestEncoding="windows-1250"
responseEncoding="windows-1250"
/>

That will give you the best of both worlds.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Ondrej Srubar" <On**********@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
Hello,
in the Web.config I have <globalization requestEncoding="utf-8"
responseEncoding="utf-8" />, but for one page I need to set the
requestEncoding="windows-1250". If I use <%@Page
RequestEncoding="windows-1250"%>, I get an error Atributte RequestEncoding is
not supported by direktive page. What is the problem?

Ondrej Srubar


Nov 19 '05 #5
re:
I need all other pages in utf-8 (i.e. in the Web.config I need
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />)
Maybe I wasn't clear enough.

You *can* place that file in a subdirectory of the *same* application,
and have its encoding set by a different web.config than one which
governs your main application directory and subdirectories.

In *that* web.config, placed in the same directory as
the file which needs windows-1250 encoding, you set :

<globalization
requestEncoding="windows-1250"
responseEncoding="windows-1250"
/>

and that will be the only page which will have that encoding,
as you said you need.

The rest of your pages will have utf-8.

Am I missing something here ?

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Ondrej Srubar" <On**********@discussions.microsoft.com> wrote in message
news:44**********************************@microsof t.com...I need requestEncoding="windows-1250" only for one page, which takes request
from another server (i.e. I can't set encoding of a response) and I need all
other pages in utf-8 "(i.e. in the Web.config I need <globalization
requestEncoding="utf-8" responseEncoding="utf-8" />).
If I set a ContentEncoding of the request in code, the property QueryString
is already encoded by utf-8.
And the @Page doesn't have a property named requestEncoding :(

Ondrej Srubar "Juan T. Llibre" wrote:
In ASP.NET, System.Web.UI.Page doesn't
have a property named requestEncoding :

http://beta.asp.net/QUICKSTART/util/....UI&class=Page

What I would do, if I were you, is place that file in a
subdirectory of your application, with a web config which has :

<globalization
requestEncoding="windows-1250"
responseEncoding="windows-1250"
/>

That will give you the best of both worlds.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Ondrej Srubar" <On**********@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
> Hello,
> in the Web.config I have <globalization requestEncoding="utf-8"
> responseEncoding="utf-8" />, but for one page I need to set the
> requestEncoding="windows-1250". If I use <%@Page
> RequestEncoding="windows-1250"%>, I get an error Atributte RequestEncoding is
> not supported by direktive page. What is the problem?
>
> Ondrej Srubar


Nov 19 '05 #6
Juan T. Llibre wrote:
re:
I need all other pages in utf-8 (i.e. in the Web.config I need
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />)


Maybe I wasn't clear enough.

You can place that file in a subdirectory of the same application,
and have its encoding set by a different web.config than one which
governs your main application directory and subdirectories.

In that web.config, placed in the same directory as
the file which needs windows-1250 encoding, you set :

<globalization
requestEncoding="windows-1250"
responseEncoding="windows-1250"
/>


Another option is to use the Application_BeginRequest callback, which
overrides any web.config setting:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (Request.Path == "/foo/Special.aspx")
{
Request.ContentEncoding = Encoding.GetEncoding(1250);
}
}

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #7
Quite interesting, Joerg, but why have an application run a procedure
every time *any* page is called, when all that's needed is for a setting
to be made when *one* particular page is called ?

That would seem to run counter to best practices for applications,
in regards to efficient architectural design.


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn***************@msnews.microsoft.com...
Juan T. Llibre wrote:
re:
> I need all other pages in utf-8 (i.e. in the Web.config I need
> <globalization requestEncoding="utf-8" responseEncoding="utf-8" />)


Maybe I wasn't clear enough.

You can place that file in a subdirectory of the same application,
and have its encoding set by a different web.config than one which
governs your main application directory and subdirectories.

In that web.config, placed in the same directory as
the file which needs windows-1250 encoding, you set :

<globalization
requestEncoding="windows-1250"
responseEncoding="windows-1250"
/>


Another option is to use the Application_BeginRequest callback, which
overrides any web.config setting:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (Request.Path == "/foo/Special.aspx")
{
Request.ContentEncoding = Encoding.GetEncoding(1250);
}
}

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 19 '05 #8
Juan T. Llibre wrote:
Quite interesting, Joerg, but why have an application run a procedure
every time any page is called, when all that's needed is for a setting
to be made when one particular page is called ?
Good question!

Well, first I think it's nice to know how to do certain things in code.

Second, assume a more dynamic scenario, where the character encoding is
based on the user's preferences (HTTP Accept-Encoding) or browser type.
Then configuration is no longer an option.
That would seem to run counter to best practices for applications,
in regards to efficient architectural design.


Well, efficiency isn't usually lost or gained at implementation level,
at least for business applications (the usual web app). As an
architect, I'd probably not even care whether a programmer decided to
use this or that approach, as long as the underlying requirement was
techncially fulfilled.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Mimi | last post by:
Hello, I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 ...
6
by: Graeme Wood | last post by:
I have an ASP page hosted on a windows 2003 server. This page was working fine until Saturday. Now, the server doesn't serve it and gives a 404 page not found error. The file DEFINITELY exists...
6
by: ima | last post by:
http://www.kencoffman.com/templates.htm I've been experimenting with float:left and I've been able to clear those floats as far as Opera 8.02 and Firefox 1.0.6 but IE6 is a problem. I've...
1
by: aben | last post by:
Hello all, I am using the following microsoft article to try and learn more about SSL: http://support.microsoft.com/default.aspx?scid=kb;EN-US;315588 I have a virtual directory that I have...
1
by: Paul | last post by:
Hi all, I've hit a strange problem with my ASP .NET site - occasionally when I go to a page, it will have part of another request's output mixed in with my output. This breaks the HTML on the...
0
by: chater buster | last post by:
Hi guys, I have an intranet website which is accessable from my machine but NOT available on network (client machine) My folder path= "C:\Inetpub\wwwroot\Webtest. Version=ASP.net1.1 IIS...
6
by: ziycon | last post by:
The AJAX is working but with a slight problem it refreshes the page after it runs map.php and all the output from map.php disappears from the screen back to the original state before map.php is...
1
by: dfahlbusch | last post by:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MessageBox.Show("2781 Beal St." & Chr(13) & "Deltona, Florida 32763" & Chr(13) &...
1
by: mvanreek | last post by:
In Access97 I want to create a report with this structure (report-sections): -Header-Text 0 --Header-Text 1: this section has a 'tally' (Textbox with running total to give each section a unique...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.