Showing posts with label setting. Show all posts
Showing posts with label setting. Show all posts

Wednesday, March 28, 2012

Set default page or Login page

Hi,

I want to change default setting for example i want to set signin.aspx as my login page or home.aspx as my default page. I saw somewhere that I could do this in web.config I can't remember where I saw!

Thanks, Amir Reza NL

You can change the loginUrl in the web.config by adding the <forms> element to the <authentication>:

<

authenticationmode="Forms">

<

formsloginUrl="">

</

authentication>

Hi

u can do this simply by right clicking on ur singin.aspx page and set it as ur start page.


The default sign-in page is done in the config file authentication/authorisation sections.

To redirect to a specifc home page can be done in a variety of ways... my preferred method is simply to add an application settings such as "HomePage" and then doing a quick test on incoming requests (server varible HTTP_REFERER) if the request originates outside the scope of you website do a redirect to the page defined as the "HomePage".

Hope this helps


I want to explain my problem further.

Suppose, u have tree sub folder (fd1,fd2,fd3) u have a page under fd1 (test.aspx) now when a user go to ~/fd1 I want test.aspx is shown to the user. One possible solution is to create default.aspx and redirect it to test.aspx but I don't like this approach.

Thanks,Amir Reza Nl


well, following is my advise:

there is a virtual directory corresponding to every folder/subfolder of your web application in IIS Manager.Find the right virtual directory( in your example, it's fd1) and perform a right click,choose thePeroperties and thenDocuments, in theEnable default content page section, you canchoose the page which you want to serve as the default page (in your example ,it's test.aspx).

there maybe some other alternative ways available, while i think what i have suggested is a good choice. think aobut it. :)

thanks.

Monday, March 26, 2012

Set dropdownlist value

I have a dropdownlist that I was setting to an index (which happened
to be the same as the value). I changed this to a character as that
is what I want to have in my database.
<asp:dropdownlist
style="border:none" id="recurrenceType"
runat="server">
<asp:listitem value="N"
>None</asp:listitem>
<asp:listitem value="M"
>Monthly</asp:listitem>
<asp:listitem value="P"
>Periodic</asp:listitem>
</asp:dropdownlist>
I was setting the value before (when the value was "0", "1" and "2").
It used to work like this:
recurrenceType.SelectedIndex = objDataReader("recurrenceType")
How would I set it with the value set to a char?
Thanks,
Tom.
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.msChange
recurrenceType.SelectedIndex = ...
To
recurrenceType.SelectedValue = ...
"tfs" wrote:

> I have a dropdownlist that I was setting to an index (which happened
> to be the same as the value). I changed this to a character as that
> is what I want to have in my database.
> <asp:dropdownlist
> style="border:none" id="recurrenceType"
> runat="server">
> <asp:listitem value="N"
> <asp:listitem value="M"
> <asp:listitem value="P"
> </asp:dropdownlist>
>
> I was setting the value before (when the value was "0", "1" and "2").
> It used to work like this:
> recurrenceType.SelectedIndex = objDataReader("recurrenceType")
> How would I set it with the value set to a char?
> Thanks,
> Tom.
>
> Posted Via mcse.ms Premium Usenet Newsgroup Services
> ----
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----
> http://www.mcse.ms
>
I just tried this:
recurrenceType.SelectedItem.value = "P"
The display on the screen is still "None".
Thanks,
Tom.
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.ms
I have tried all kinds of ways to get this to work and keep getting
strange (at least to me) results.
If I do a viewsource of the above statement (my last post):
recurrenceType.SelectedItem.value = "P"
I get the following:
<select name="recurrenceType" id="recurrenceType"
style="border:none">
<option selected="selected" value="P">None</option>
<option value="M">Monthly</option>
<option value="P">Periodic</option>
</select>
It seems to change the value, which I guess is what I am saying - but
this is how I saw it selected in one example. I am trying to get it
to move the selected="selected" to the 3rd option and it isn't doing
it.
I then tried:
recurrenceType.Items.FindByValue("P").selected = true
And got the following error:
A DropDownList cannot have multiple items selected.
Description: An unhandled exception occurred during the execution
of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: A DropDownList
cannot have multiple items selected.
Source Error:
Line 132: </table>
Line 133:
Line 134: <form runat="server">
Line 135: <table align="center">
Line 136: <tr
valign="baseline">
This is driving me crazy.
Thanks,
Tom.
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.ms
The syntax should be something close to this:
recurrenceType.SelectedItem=recurrenceType.Items.FindByValue("P")
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"tfs" <tfs@.dslextreme-dot-com.no-spam.invalid> wrote in message
news:40eb0582$1_1@.mcse.ms...
> I have a dropdownlist that I was setting to an index (which happened
> to be the same as the value). I changed this to a character as that
> is what I want to have in my database.
> <asp:dropdownlist
> style="border:none" id="recurrenceType"
> runat="server">
> <asp:listitem value="N"
> <asp:listitem value="M"
> <asp:listitem value="P"
> </asp:dropdownlist>
>
> I was setting the value before (when the value was "0", "1" and "2").
> It used to work like this:
> recurrenceType.SelectedIndex = objDataReader("recurrenceType")
> How would I set it with the value set to a char?
> Thanks,
> Tom.
>
> Posted Via mcse.ms Premium Usenet Newsgroup Services
> ----
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----
> http://www.mcse.ms
I think what you are looking for is -
((ListItem)recurrenceType.Items.FindByValue("P")).Selected = true;
Bobby Ryzhy
bobby@.wendtech.net
[url]http://www.wendtech.net[/url]
On Tue, 6 Jul 2004 14:43:16 -0700, "Steve C. Orr [MVP, MCSD]"
<Steve@.Orr.net> wrote:

>The syntax should be something close to this:
>recurrenceType.SelectedItem=recurrenceType.Items.FindByValue("P")
Yes, I believe that is more precise.
"Bobby Ryzhy" <bryzhy@.hotmail.com> wrote in message
news:vt8me0l7uanmgb9iln5o7nsvbal012e867@.
4ax.com...
> I think what you are looking for is -
> ((ListItem)recurrenceType.Items.FindByValue("P")).Selected = true;
> Bobby Ryzhy
> bobby@.wendtech.net
> [url]http://www.wendtech.net[/url]
>
> On Tue, 6 Jul 2004 14:43:16 -0700, "Steve C. Orr [MVP, MCSD]"
> <Steve@.Orr.net> wrote:
>
>
SelectValue was it.
Here is what I did that works fine.
recurrenceType.SelectedValue =
objDataReader("recurrenceType")
recurrenceDisplay.text = recurrenceType.SelectedItem.text
<td nowrap>Recurrance:</td>
<td>
<asp:label id="recurrenceDisplay"
runat="server" />
<asp:dropdownlist style="visibility:hidden"
id="recurrenceType" runat="server">
<asp:listitem value="N"
>None</asp:listitem>
<asp:listitem value="M"
>Monthly</asp:listitem>
<asp:listitem value="P"
>Periodic</asp:listitem>
</asp:dropdownlist>
</td>
Thanks,
Tom
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.ms

Set dropdownlist value

I have a dropdownlist that I was setting to an index (which happened
to be the same as the value). I changed this to a character as that
is what I want to have in my database.

<asp:dropdownlist
style="border:none" id="recurrenceType"
runat="server">
<asp:listitem value="N"
>None</asp:listitem>
<asp:listitem value="M"
>Monthly</asp:listitem>
<asp:listitem value="P"
>Periodic</asp:listitem>
</asp:dropdownlist
I was setting the value before (when the value was "0", "1" and "2").
It used to work like this:

recurrenceType.SelectedIndex = objDataReader("recurrenceType")

How would I set it with the value set to a char?

Thanks,

Tom.

Posted Via Usenet.com Premium Usenet Newsgroup Services
------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
------------------
http://www.usenet.comI have tried all kinds of ways to get this to work and keep getting
strange (at least to me) results.

If I do a viewsource of the above statement (my last post):

recurrenceType.SelectedItem.value = "P"

I get the following:

<select name="recurrenceType" id="recurrenceType"
style="border:none">
<option selected="selected" value="P">None</option>
<option value="M">Monthly</option>
<option value="P">Periodic</option>
</select
It seems to change the value, which I guess is what I am saying - but
this is how I saw it selected in one example. I am trying to get it
to move the selected="selected" to the 3rd option and it isn't doing
it.

I then tried:

recurrenceType.Items.FindByValue("P").selected = true

And got the following error:

A DropDownList cannot have multiple items selected.
Description: An unhandled exception occurred during the execution
of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A DropDownList
cannot have multiple items selected.

Source Error:

Line 132: </table>
Line 133:
Line 134: <form runat="server">
Line 135: <table align="center">
Line 136: <tr
valign="baseline"
This is driving me crazy.

Thanks,

Tom.

Posted Via Usenet.com Premium Usenet Newsgroup Services
------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
------------------
http://www.usenet.com
I just tried this:

recurrenceType.SelectedItem.value = "P"

The display on the screen is still "None".

Thanks,

Tom.

Posted Via Usenet.com Premium Usenet Newsgroup Services
------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
------------------
http://www.usenet.com
The syntax should be something close to this:

recurrenceType.SelectedItem=recurrenceType.Items.F indByValue("P")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"tfs" <tfs@.dslextreme-dot-com.no-spam.invalid> wrote in message
news:40eb0582$1_1@.Usenet.com...
> I have a dropdownlist that I was setting to an index (which happened
> to be the same as the value). I changed this to a character as that
> is what I want to have in my database.
> <asp:dropdownlist
> style="border:none" id="recurrenceType"
> runat="server">
> <asp:listitem value="N"
> >None</asp:listitem>
> <asp:listitem value="M"
> >Monthly</asp:listitem>
> <asp:listitem value="P"
> >Periodic</asp:listitem>
> </asp:dropdownlist>
>
> I was setting the value before (when the value was "0", "1" and "2").
> It used to work like this:
> recurrenceType.SelectedIndex = objDataReader("recurrenceType")
> How would I set it with the value set to a char?
> Thanks,
> Tom.
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ------------------
> http://www.usenet.com
I think what you are looking for is -
((ListItem)recurrenceType.Items.FindByValue("P")).Selected = true;

Bobby Ryzhy
bobby@.weekendtech.net
http://www.weekendtech.net

On Tue, 6 Jul 2004 14:43:16 -0700, "Steve C. Orr [MVP, MCSD]"
<Steve@.Orr.net> wrote:

>The syntax should be something close to this:
>recurrenceType.SelectedItem=recurrenceType.Items.F indByValue("P")
Yes, I believe that is more precise.

"Bobby Ryzhy" <bryzhy@.hotmail.com> wrote in message
news:vt8me0l7uanmgb9iln5o7nsvbal012e867@.4ax.com...
> I think what you are looking for is -
> ((ListItem)recurrenceType.Items.FindByValue("P")).Selected = true;
> Bobby Ryzhy
> bobby@.weekendtech.net
> http://www.weekendtech.net
>
> On Tue, 6 Jul 2004 14:43:16 -0700, "Steve C. Orr [MVP, MCSD]"
> <Steve@.Orr.net> wrote:
> >The syntax should be something close to this:
> >recurrenceType.SelectedItem=recurrenceType.Items.F indByValue("P")
SelectValue was it.

Here is what I did that works fine.

recurrenceType.SelectedValue =
objDataReader("recurrenceType")
recurrenceDisplay.text = recurrenceType.SelectedItem.text

<td nowrap align="right">Recurrance:</td>
<td>
<asp:label id="recurrenceDisplay"
runat="server" />
<asp:dropdownlist style="visibility:hidden"
id="recurrenceType" runat="server">
<asp:listitem value="N"
>None</asp:listitem>
<asp:listitem value="M"
>Monthly</asp:listitem>
<asp:listitem value="P"
>Periodic</asp:listitem>
</asp:dropdownlist>
</td
Thanks,

Tom

Posted Via Usenet.com Premium Usenet Newsgroup Services
------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
------------------
http://www.usenet.com

set Expires tag for images?

Hi - I want to reduce the download time of various pages by setting the
'Expires' tag for various images to a future date (this will then stop the
browser from re-requesting these for each new session).

I'm hosting on a commercial service so I don't have direct access to IIS
configuration. Is there anyway I can control this from my server-side code?

Thanks,

Paul.Paul W wrote:

> Hi - I want to reduce the download time of various pages by setting
> the 'Expires' tag for various images to a future date (this will then
> stop the browser from re-requesting these for each new session).
> I'm hosting on a commercial service so I don't have direct access to
> IIS configuration. Is there anyway I can control this from my
> server-side code?

Not if the images are served directly by IIS. Your ISP should be able
to change the server configuration to allow for caching.

BTW, you should prefer Cache-Control: max-age over Expires.

Cheers,
--
http://www.joergjooss.de
mailto:news-reply@.joergjooss.de
Currently the images ARE directly served by IIS. Can you point me to how
else I could do this so I can set the "Cache-Control: max-age"? Thanks,

Paul.
----
"Joerg Jooss" <news-reply@.joergjooss.de> wrote in message
news:xn0e3b26b6h8ll002@.msnews.microsoft.com...
> Paul W wrote:
>> Hi - I want to reduce the download time of various pages by setting
>> the 'Expires' tag for various images to a future date (this will then
>> stop the browser from re-requesting these for each new session).
>>
>> I'm hosting on a commercial service so I don't have direct access to
>> IIS configuration. Is there anyway I can control this from my
>> server-side code?
> Not if the images are served directly by IIS. Your ISP should be able
> to change the server configuration to allow for caching.
> BTW, you should prefer Cache-Control: max-age over Expires.
> Cheers,
> --
> http://www.joergjooss.de
> mailto:news-reply@.joergjooss.de
Paul W wrote:

> Currently the images ARE directly served by IIS. Can you point me to
> how else I could do this so I can set the "Cache-Control: max-age"?
> Thanks,

You could implemment a HttpHandler that serves your images, but this is
really a waste of time. Ask your service provider to change your IIS
configuration.

Cheers,
--
http://www.joergjooss.de
mailto:news-reply@.joergjooss.de

Saturday, March 24, 2012

set focus on postback/textchanged

I'm setting focus depenting upon which field has changed value. I'm doing
this with the following: Page.RegisterStartupScript("SetFocus", "<script
language=""Jscript"" > document.getElementById(""txtCity"").focus();
</Script>"). This is being called on the textChanged event for textboxes. fo
r
city it goes to state for state it goes to zip, ...
It works, but is this the correct way to do this or should this be a seties
of if then else's in he page load? if so, how can i isolate the textbox that
caused the event?
thanks
kesYou can change the javascript you have below to generate the name of the
control that caused the event:
Page.RegisterStartupScript("SetFocus", "<script language='Jscript'>
document.getElementById(" + controlName + ").focus(); </Script>").
in the "Changed" event of the control just set the "controlName" variable to
the required javascript id for the control:
i.e. for the txtCity changed event:
controlName = "txtCity";
I'm assuming that you are calling the Page.RegisterStartupScript() function
in the "Render" event of the page - you'll need to remember that because the
"Render" is called after the "Changed" event and thats what you want, if you
put the Page.RegisterStartupScript() in the Page_Load() by mistake, then the
"controlName" variable will not be assigned a value yet.
"Kurt Schroeder" wrote:

> I'm setting focus depenting upon which field has changed value. I'm doing
> this with the following: Page.RegisterStartupScript("SetFocus", "<script
> language=""Jscript"" > document.getElementById(""txtCity"").focus();
> </Script>"). This is being called on the textChanged event for textboxes.
for
> city it goes to state for state it goes to zip, ...
> It works, but is this the correct way to do this or should this be a setie
s
> of if then else's in he page load? if so, how can i isolate the textbox th
at
> caused the event?
> thanks
> kes
Thank you for replying!
i have the function call in each of the respective controls' changed event
:
Example:
Private Sub txtbAdr1_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles txtbAdr1.TextChanged
If chkShipSame.Checked Then
txtSadr1.Text = txtbAdr1.Text
Page.RegisterStartupScript("SetFocus", "<script
language=""Javascript"" > document.getElementById(""txtbadr2"").focus();
</Script>")
End If
End Sub
In vS.net i could not find the Render event under page, but i'm still
learning this. as well as JavaScript. I see PreRender, but not render.
1. My guess is the funtion calls are not in the right place, but should only
be one function call in the Render event?
2. where can i find Render?
3. the controlname variable is this a simple .net string variable or a
javascript variable?
Thanks
kes
"Jorge L Matos [MCSD.NET]" wrote:
> You can change the javascript you have below to generate the name of the
> control that caused the event:
> Page.RegisterStartupScript("SetFocus", "<script language='Jscript'>
> document.getElementById(" + controlName + ").focus(); </Script>").
> in the "Changed" event of the control just set the "controlName" variable
to
> the required javascript id for the control:
> i.e. for the txtCity changed event:
> controlName = "txtCity";
> I'm assuming that you are calling the Page.RegisterStartupScript() functio
n
> in the "Render" event of the page - you'll need to remember that because t
he
> "Render" is called after the "Changed" event and thats what you want, if y
ou
> put the Page.RegisterStartupScript() in the Page_Load() by mistake, then t
he
> "controlName" variable will not be assigned a value yet.
> "Kurt Schroeder" wrote:
>
Sorry, I meant the "PreRender" event, not the "Render".
Answers:
1. Yes, but use "PreRender" not "Render"
2. Don't worry about Render
3. The controlName variable is a field of the "Page" class that you create
and all the "Change" events can set it to the javascript ID of the control.
The page events are typically executed in the following order:
a) Init
b) Load
c) Change Events
d) Click Events
e) PreRender
f) Render
REF:
http://msdn.microsoft.com/library/d...onlifecycle.asp
ASP.NET 2.0 will have an enhanced page event life cycle with more events
that you can hook into.
"Kurt Schroeder" wrote:
> Thank you for replying!
> i have the function call in each of the respective controls' changed eve
nt:
> Example:
> Private Sub txtbAdr1_TextChanged(ByVal sender As System.Object, ByVal
e
> As System.EventArgs) Handles txtbAdr1.TextChanged
> If chkShipSame.Checked Then
> txtSadr1.Text = txtbAdr1.Text
> Page.RegisterStartupScript("SetFocus", "<script
> language=""Javascript"" > document.getElementById(""txtbadr2"").focus();
> </Script>")
> End If
> End Sub
> In vS.net i could not find the Render event under page, but i'm still
> learning this. as well as JavaScript. I see PreRender, but not render.
> 1. My guess is the funtion calls are not in the right place, but should on
ly
> be one function call in the Render event?
> 2. where can i find Render?
> 3. the controlname variable is this a simple .net string variable or a
> javascript variable?
> Thanks
> kes
> "Jorge L Matos [MCSD.NET]" wrote:
>

set focus on postback/textchanged

I'm setting focus depenting upon which field has changed value. I'm doing
this with the following: Page.RegisterStartupScript("SetFocus", "<script
language=""Jscript"" > document.getElementById(""txtCity"").focus();
</Script>"). This is being called on the textChanged event for textboxes. for
city it goes to state for state it goes to zip, ...
It works, but is this the correct way to do this or should this be a seties
of if then else's in he page load? if so, how can i isolate the textbox that
caused the event?

thanks
kesYou can change the javascript you have below to generate the name of the
control that caused the event:

Page.RegisterStartupScript("SetFocus", "<script language='Jscript'>
document.getElementById(" + controlName + ").focus(); </Script>").

in the "Changed" event of the control just set the "controlName" variable to
the required javascript id for the control:

i.e. for the txtCity changed event:

controlName = "txtCity";

I'm assuming that you are calling the Page.RegisterStartupScript() function
in the "Render" event of the page - you'll need to remember that because the
"Render" is called after the "Changed" event and thats what you want, if you
put the Page.RegisterStartupScript() in the Page_Load() by mistake, then the
"controlName" variable will not be assigned a value yet.

"Kurt Schroeder" wrote:

> I'm setting focus depenting upon which field has changed value. I'm doing
> this with the following: Page.RegisterStartupScript("SetFocus", "<script
> language=""Jscript"" > document.getElementById(""txtCity"").focus();
> </Script>"). This is being called on the textChanged event for textboxes. for
> city it goes to state for state it goes to zip, ...
> It works, but is this the correct way to do this or should this be a seties
> of if then else's in he page load? if so, how can i isolate the textbox that
> caused the event?
> thanks
> kes
Thank you for replying!

i have the function call in each of the respective controls' changed event:
Example:
Private Sub txtbAdr1_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles txtbAdr1.TextChanged
If chkShipSame.Checked Then
txtSadr1.Text = txtbAdr1.Text
Page.RegisterStartupScript("SetFocus", "<script
language=""Javascript"" > document.getElementById(""txtbadr2"").focus();
</Script>")
End If
End Sub

In vS.net i could not find the Render event under page, but i'm still
learning this. as well as JavaScript. I see PreRender, but not render.
1. My guess is the funtion calls are not in the right place, but should only
be one function call in the Render event?
2. where can i find Render?
3. the controlname variable is this a simple .net string variable or a
javascript variable?
Thanks
kes

"Jorge L Matos [MCSD.NET]" wrote:

> You can change the javascript you have below to generate the name of the
> control that caused the event:
> Page.RegisterStartupScript("SetFocus", "<script language='Jscript'>
> document.getElementById(" + controlName + ").focus(); </Script>").
> in the "Changed" event of the control just set the "controlName" variable to
> the required javascript id for the control:
> i.e. for the txtCity changed event:
> controlName = "txtCity";
> I'm assuming that you are calling the Page.RegisterStartupScript() function
> in the "Render" event of the page - you'll need to remember that because the
> "Render" is called after the "Changed" event and thats what you want, if you
> put the Page.RegisterStartupScript() in the Page_Load() by mistake, then the
> "controlName" variable will not be assigned a value yet.
> "Kurt Schroeder" wrote:
> > I'm setting focus depenting upon which field has changed value. I'm doing
> > this with the following: Page.RegisterStartupScript("SetFocus", "<script
> > language=""Jscript"" > document.getElementById(""txtCity"").focus();
> > </Script>"). This is being called on the textChanged event for textboxes. for
> > city it goes to state for state it goes to zip, ...
> > It works, but is this the correct way to do this or should this be a seties
> > of if then else's in he page load? if so, how can i isolate the textbox that
> > caused the event?
> > thanks
> > kes
Sorry, I meant the "PreRender" event, not the "Render".

Answers:
1. Yes, but use "PreRender" not "Render"
2. Don't worry about Render
3. The controlName variable is a field of the "Page" class that you create
and all the "Change" events can set it to the javascript ID of the control.

The page events are typically executed in the following order:
a) Init
b) Load
c) Change Events
d) Click Events
e) PreRender
f) Render

REF:
http://msdn.microsoft.com/library/d...onlifecycle.asp

ASP.NET 2.0 will have an enhanced page event life cycle with more events
that you can hook into.

"Kurt Schroeder" wrote:

> Thank you for replying!
> i have the function call in each of the respective controls' changed event:
> Example:
> Private Sub txtbAdr1_TextChanged(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles txtbAdr1.TextChanged
> If chkShipSame.Checked Then
> txtSadr1.Text = txtbAdr1.Text
> Page.RegisterStartupScript("SetFocus", "<script
> language=""Javascript"" > document.getElementById(""txtbadr2"").focus();
> </Script>")
> End If
> End Sub
> In vS.net i could not find the Render event under page, but i'm still
> learning this. as well as JavaScript. I see PreRender, but not render.
> 1. My guess is the funtion calls are not in the right place, but should only
> be one function call in the Render event?
> 2. where can i find Render?
> 3. the controlname variable is this a simple .net string variable or a
> javascript variable?
> Thanks
> kes
> "Jorge L Matos [MCSD.NET]" wrote:
> > You can change the javascript you have below to generate the name of the
> > control that caused the event:
> > Page.RegisterStartupScript("SetFocus", "<script language='Jscript'>
> > document.getElementById(" + controlName + ").focus(); </Script>").
> > in the "Changed" event of the control just set the "controlName" variable to
> > the required javascript id for the control:
> > i.e. for the txtCity changed event:
> > controlName = "txtCity";
> > I'm assuming that you are calling the Page.RegisterStartupScript() function
> > in the "Render" event of the page - you'll need to remember that because the
> > "Render" is called after the "Changed" event and thats what you want, if you
> > put the Page.RegisterStartupScript() in the Page_Load() by mistake, then the
> > "controlName" variable will not be assigned a value yet.
> > "Kurt Schroeder" wrote:
> > > I'm setting focus depenting upon which field has changed value. I'm doing
> > > this with the following: Page.RegisterStartupScript("SetFocus", "<script
> > > language=""Jscript"" > document.getElementById(""txtCity"").focus();
> > > </Script>"). This is being called on the textChanged event for textboxes. for
> > > city it goes to state for state it goes to zip, ...
> > > It works, but is this the correct way to do this or should this be a seties
> > > of if then else's in he page load? if so, how can i isolate the textbox that
> > > caused the event?
> > > > thanks
> > > kes

Tuesday, March 13, 2012

SET NOCOUNT ON OPTION

DOES SETTING NOCOUNT ON option affect my stored procedures and website
performance in anyway within my asp.net application?
When and when not to set SET NOCOUNT ON?
I know what it does but not exactly where and when I want to use it.
i.e.
CREATE PROCEDURE GetAuthorization 2.0
@dotnet.itags.org.Username Varchar( 20 ),
@dotnet.itags.org.Password Varchar( 16 )
as
SET NOCOUNT ON
declare @dotnet.itags.org.AccountID int
set @dotnet.itags.org.AccountID = -1
select @dotnet.itags.org.AccountID =
case
when Password = @dotnet.itags.org.Password and Active = 1 then AccountID
when Password = @dotnet.itags.org.Password then -2
else -3
end
from Account
where Username = @dotnet.itags.org.Username
return @dotnet.itags.org.AccountID
goA sp is able to return motre than one resultset.
Even an update or an insert returns resultset, but in many case you don't
need that.
With nocount option you obtain only the resultset relative to last query.
"Leon" <vnality@.msn.com> ha scritto nel messaggio
news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
> DOES SETTING NOCOUNT ON option affect my stored procedures and website
> performance in anyway within my asp.net application?
> When and when not to set SET NOCOUNT ON?
> I know what it does but not exactly where and when I want to use it.
> i.e.
> CREATE PROCEDURE GetAuthorization 2.0
> @.Username Varchar( 20 ),
> @.Password Varchar( 16 )
> as
> SET NOCOUNT ON
> declare @.AccountID int
> set @.AccountID = -1
> select @.AccountID =
> case
> when Password = @.Password and Active = 1 then AccountID
> when Password = @.Password then -2
> else -3
> end
> from Account
> where Username = @.Username
> return @.AccountID
> go
>
>
So is it good or bad to use SET NOCOUNT ON?
use my example sp for explanation. Thanks!
"Cirrosi" <CirrosiN_O-S_P_A-M@.fastwebnet.it> wrote in message
news:66pdd.15666$1q2.1609@.tornado.fastwebnet.it...
>A sp is able to return motre than one resultset.
> Even an update or an insert returns resultset, but in many case you don't
> need that.
> With nocount option you obtain only the resultset relative to last query.
> "Leon" <vnality@.msn.com> ha scritto nel messaggio
> news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
>
I tink that is better using it.
It avoid that a procedure return more than one resultset, then it should
execute quickly.
Your sp don't return any resultset than you shoul use it.
Excuse me for my bad english.
"Leon" <vnality@.msn.com> ha scritto nel messaggio
news:ue62yDotEHA.3860@.TK2MSFTNGP09.phx.gbl...
> So is it good or bad to use SET NOCOUNT ON?
> use my example sp for explanation. Thanks!
> "Cirrosi" <CirrosiN_O-S_P_A-M@.fastwebnet.it> wrote in message
> news:66pdd.15666$1q2.1609@.tornado.fastwebnet.it...
>
Thank Again!
"Cirrosi" <CirrosiN_O-S_P_A-M@.fastwebnet.it> wrote in message
news:Dsqdd.15801$1q2.13733@.tornado.fastwebnet.it...
>I tink that is better using it.
> It avoid that a procedure return more than one resultset, then it should
> execute quickly.
> Your sp don't return any resultset than you shoul use it.
> Excuse me for my bad english.
> "Leon" <vnality@.msn.com> ha scritto nel messaggio
> news:ue62yDotEHA.3860@.TK2MSFTNGP09.phx.gbl...
>
Hi all.
Open Query Analyzer. Execute any of your sprocs that don't have SET NOCOUNT
ON. You'll have your results (if it returns any recordsets) and a message
saying something like "(n row(s) affected)". To get this message SqlServer
needs to make two trips. Insert SET NOCOUNT ON into the text of your sproc
right after AS, save and execute it again. There will be no messages and no
additional trips this time resulting in a faster response. That's the
difference.
"Leon" <vnality@.msn.com> wrote in message
news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
> DOES SETTING NOCOUNT ON option affect my stored procedures and website
> performance in anyway within my asp.net application?
> When and when not to set SET NOCOUNT ON?
> I know what it does but not exactly where and when I want to use it.
> i.e.
> CREATE PROCEDURE GetAuthorization 2.0
> @.Username Varchar( 20 ),
> @.Password Varchar( 16 )
> as
> SET NOCOUNT ON
> declare @.AccountID int
> set @.AccountID = -1
> select @.AccountID =
> case
> when Password = @.Password and Active = 1 then AccountID
> when Password = @.Password then -2
> else -3
> end
> from Account
> where Username = @.Username
> return @.AccountID
> go
>
>
Thanks Kikoz!
"Kikoz" <kikoz@.hotmail.com> wrote in message
news:eaPO9pqtEHA.444@.TK2MSFTNGP10.phx.gbl...
> Hi all.
> Open Query Analyzer. Execute any of your sprocs that don't have SET
> NOCOUNT ON. You'll have your results (if it returns any recordsets) and a
> message saying something like "(n row(s) affected)". To get this message
> SqlServer needs to make two trips. Insert SET NOCOUNT ON into the text of
> your sproc right after AS, save and execute it again. There will be no
> messages and no additional trips this time resulting in a faster response.
> That's the difference.
>
> "Leon" <vnality@.msn.com> wrote in message
> news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
>
From T-SQL Manual:
Syntax
SET NOCOUNT { ON | OFF }
Remarks
When SET NOCOUNT is ON, the count (indicating the number of rows affected by
a Transact-SQL statement) is not returned. When SET NOCOUNT is OFF, the cou
nt is returned.
The @.@.ROWCOUNT function is updated even when SET NOCOUNT is ON.
SET NOCOUNT ON eliminates the sending of DONE_IN_PROC messages to the client
for each statement in a stored procedure. When using the utilities provided
with Microsoft SQL ServerT to execute queries, the results prevent "nn row
s affected" from being displayed at the end Transact-SQL statements such as
SELECT, INSERT, UPDATE, and DELETE.
For stored procedures that contain several statements that do not return muc
h actual data, this can provide a significant performance boost because netw
ork traffic is greatly reduced.
The setting of SET NOCOUNT is set at execute or run time and not at parse ti
me.
"Leon" <vnality@.msn.com> ha scritto nel messaggio news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gb
l...
> DOES SETTING NOCOUNT ON option affect my stored procedures and website
> performance in anyway within my asp.net application?
>
> When and when not to set SET NOCOUNT ON?
>
> I know what it does but not exactly where and when I want to use it.
>
> i.e.
> CREATE PROCEDURE GetAuthorization 2.0
> @.Username Varchar( 20 ),
> @.Password Varchar( 16 )
> as
> SET NOCOUNT ON
> declare @.AccountID int
>
> set @.AccountID = -1
> select @.AccountID =
> case
> when Password = @.Password and Active = 1 then AccountID
> when Password = @.Password then -2
> else -3
> end
> from Account
> where Username = @.Username
>
> return @.AccountID
> go
>
>
>

SET NOCOUNT ON OPTION

DOES SETTING NOCOUNT ON option affect my stored procedures and website
performance in anyway within my asp.net application?

When and when not to set SET NOCOUNT ON?

I know what it does but not exactly where and when I want to use it.

i.e.
CREATE PROCEDURE GetAuthorization 2.0
@dotnet.itags.org.Username Varchar( 20 ),
@dotnet.itags.org.Password Varchar( 16 )
as
SET NOCOUNT ON
declare @dotnet.itags.org.AccountID int

set @dotnet.itags.org.AccountID = -1
select @dotnet.itags.org.AccountID =
case
when Password = @dotnet.itags.org.Password and Active = 1 then AccountID
when Password = @dotnet.itags.org.Password then -2
else -3
end
from Account
where Username = @dotnet.itags.org.Username

return @dotnet.itags.org.AccountID
goA sp is able to return motre than one resultset.
Even an update or an insert returns resultset, but in many case you don't
need that.
With nocount option you obtain only the resultset relative to last query.

"Leon" <vnality@.msn.com> ha scritto nel messaggio
news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
> DOES SETTING NOCOUNT ON option affect my stored procedures and website
> performance in anyway within my asp.net application?
> When and when not to set SET NOCOUNT ON?
> I know what it does but not exactly where and when I want to use it.
> i.e.
> CREATE PROCEDURE GetAuthorization 2.0
> @.Username Varchar( 20 ),
> @.Password Varchar( 16 )
> as
> SET NOCOUNT ON
> declare @.AccountID int
> set @.AccountID = -1
> select @.AccountID =
> case
> when Password = @.Password and Active = 1 then AccountID
> when Password = @.Password then -2
> else -3
> end
> from Account
> where Username = @.Username
> return @.AccountID
> go
So is it good or bad to use SET NOCOUNT ON?
use my example sp for explanation. Thanks!

"Cirrosi" <CirrosiN_O-S_P_A-M@.fastwebnet.it> wrote in message
news:66pdd.15666$1q2.1609@.tornado.fastwebnet.it...
>A sp is able to return motre than one resultset.
> Even an update or an insert returns resultset, but in many case you don't
> need that.
> With nocount option you obtain only the resultset relative to last query.
> "Leon" <vnality@.msn.com> ha scritto nel messaggio
> news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
>> DOES SETTING NOCOUNT ON option affect my stored procedures and website
>> performance in anyway within my asp.net application?
>>
>> When and when not to set SET NOCOUNT ON?
>>
>> I know what it does but not exactly where and when I want to use it.
>>
>> i.e.
>> CREATE PROCEDURE GetAuthorization 2.0
>> @.Username Varchar( 20 ),
>> @.Password Varchar( 16 )
>> as
>> SET NOCOUNT ON
>> declare @.AccountID int
>>
>> set @.AccountID = -1
>> select @.AccountID =
>> case
>> when Password = @.Password and Active = 1 then AccountID
>> when Password = @.Password then -2
>> else -3
>> end
>> from Account
>> where Username = @.Username
>>
>> return @.AccountID
>> go
>>
>>
>>
I tink that is better using it.
It avoid that a procedure return more than one resultset, then it should
execute quickly.
Your sp don't return any resultset than you shoul use it.

Excuse me for my bad english.

"Leon" <vnality@.msn.com> ha scritto nel messaggio
news:ue62yDotEHA.3860@.TK2MSFTNGP09.phx.gbl...
> So is it good or bad to use SET NOCOUNT ON?
> use my example sp for explanation. Thanks!
> "Cirrosi" <CirrosiN_O-S_P_A-M@.fastwebnet.it> wrote in message
> news:66pdd.15666$1q2.1609@.tornado.fastwebnet.it...
>>A sp is able to return motre than one resultset.
>> Even an update or an insert returns resultset, but in many case you don't
>> need that.
>> With nocount option you obtain only the resultset relative to last query.
>>
>> "Leon" <vnality@.msn.com> ha scritto nel messaggio
>> news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
>>> DOES SETTING NOCOUNT ON option affect my stored procedures and website
>>> performance in anyway within my asp.net application?
>>>
>>> When and when not to set SET NOCOUNT ON?
>>>
>>> I know what it does but not exactly where and when I want to use it.
>>>
>>> i.e.
>>> CREATE PROCEDURE GetAuthorization 2.0
>>> @.Username Varchar( 20 ),
>>> @.Password Varchar( 16 )
>>> as
>>> SET NOCOUNT ON
>>> declare @.AccountID int
>>>
>>> set @.AccountID = -1
>>> select @.AccountID =
>>> case
>>> when Password = @.Password and Active = 1 then
>>> AccountID
>>> when Password = @.Password then -2
>>> else -3
>>> end
>>> from Account
>>> where Username = @.Username
>>>
>>> return @.AccountID
>>> go
>>>
>>>
>>>
>>
>>
Thank Again!

"Cirrosi" <CirrosiN_O-S_P_A-M@.fastwebnet.it> wrote in message
news:Dsqdd.15801$1q2.13733@.tornado.fastwebnet.it.. .
>I tink that is better using it.
> It avoid that a procedure return more than one resultset, then it should
> execute quickly.
> Your sp don't return any resultset than you shoul use it.
> Excuse me for my bad english.
> "Leon" <vnality@.msn.com> ha scritto nel messaggio
> news:ue62yDotEHA.3860@.TK2MSFTNGP09.phx.gbl...
>> So is it good or bad to use SET NOCOUNT ON?
>> use my example sp for explanation. Thanks!
>>
>> "Cirrosi" <CirrosiN_O-S_P_A-M@.fastwebnet.it> wrote in message
>> news:66pdd.15666$1q2.1609@.tornado.fastwebnet.it...
>>>A sp is able to return motre than one resultset.
>>> Even an update or an insert returns resultset, but in many case you
>>> don't need that.
>>> With nocount option you obtain only the resultset relative to last
>>> query.
>>>
>>> "Leon" <vnality@.msn.com> ha scritto nel messaggio
>>> news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
>>>> DOES SETTING NOCOUNT ON option affect my stored procedures and website
>>>> performance in anyway within my asp.net application?
>>>>
>>>> When and when not to set SET NOCOUNT ON?
>>>>
>>>> I know what it does but not exactly where and when I want to use it.
>>>>
>>>> i.e.
>>>> CREATE PROCEDURE GetAuthorization 2.0
>>>> @.Username Varchar( 20 ),
>>>> @.Password Varchar( 16 )
>>>> as
>>>> SET NOCOUNT ON
>>>> declare @.AccountID int
>>>>
>>>> set @.AccountID = -1
>>>> select @.AccountID =
>>>> case
>>>> when Password = @.Password and Active = 1 then
>>>> AccountID
>>>> when Password = @.Password then -2
>>>> else -3
>>>> end
>>>> from Account
>>>> where Username = @.Username
>>>>
>>>> return @.AccountID
>>>> go
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
Hi all.

Open Query Analyzer. Execute any of your sprocs that don't have SET NOCOUNT
ON. You'll have your results (if it returns any recordsets) and a message
saying something like "(n row(s) affected)". To get this message SqlServer
needs to make two trips. Insert SET NOCOUNT ON into the text of your sproc
right after AS, save and execute it again. There will be no messages and no
additional trips this time resulting in a faster response. That's the
difference.

"Leon" <vnality@.msn.com> wrote in message
news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
> DOES SETTING NOCOUNT ON option affect my stored procedures and website
> performance in anyway within my asp.net application?
> When and when not to set SET NOCOUNT ON?
> I know what it does but not exactly where and when I want to use it.
> i.e.
> CREATE PROCEDURE GetAuthorization 2.0
> @.Username Varchar( 20 ),
> @.Password Varchar( 16 )
> as
> SET NOCOUNT ON
> declare @.AccountID int
> set @.AccountID = -1
> select @.AccountID =
> case
> when Password = @.Password and Active = 1 then AccountID
> when Password = @.Password then -2
> else -3
> end
> from Account
> where Username = @.Username
> return @.AccountID
> go
Thanks Kikoz!

"Kikoz" <kikoz@.hotmail.com> wrote in message
news:eaPO9pqtEHA.444@.TK2MSFTNGP10.phx.gbl...
> Hi all.
> Open Query Analyzer. Execute any of your sprocs that don't have SET
> NOCOUNT ON. You'll have your results (if it returns any recordsets) and a
> message saying something like "(n row(s) affected)". To get this message
> SqlServer needs to make two trips. Insert SET NOCOUNT ON into the text of
> your sproc right after AS, save and execute it again. There will be no
> messages and no additional trips this time resulting in a faster response.
> That's the difference.
>
> "Leon" <vnality@.msn.com> wrote in message
> news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
>> DOES SETTING NOCOUNT ON option affect my stored procedures and website
>> performance in anyway within my asp.net application?
>>
>> When and when not to set SET NOCOUNT ON?
>>
>> I know what it does but not exactly where and when I want to use it.
>>
>> i.e.
>> CREATE PROCEDURE GetAuthorization 2.0
>> @.Username Varchar( 20 ),
>> @.Password Varchar( 16 )
>> as
>> SET NOCOUNT ON
>> declare @.AccountID int
>>
>> set @.AccountID = -1
>> select @.AccountID =
>> case
>> when Password = @.Password and Active = 1 then AccountID
>> when Password = @.Password then -2
>> else -3
>> end
>> from Account
>> where Username = @.Username
>>
>> return @.AccountID
>> go
>>
>>
>>
From T-SQL Manual:
Syntax
SET NOCOUNT { ON | OFF }

Remarks
When SET NOCOUNT is ON, the count (indicating the number of rows affected by a Transact-SQL statement) is not returned. When SET NOCOUNT is OFF, the count is returned.

The @.@.ROWCOUNT function is updated even when SET NOCOUNT is ON.

SET NOCOUNT ON eliminates the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. When using the utilities provided with Microsoft SQL ServerT to execute queries, the results prevent "nn rows affected" from being displayed at the end Transact-SQL statements such as SELECT, INSERT, UPDATE, and DELETE.

For stored procedures that contain several statements that do not return much actual data, this can provide a significant performance boost because network traffic is greatly reduced.

The setting of SET NOCOUNT is set at execute or run time and not at parse time.

"Leon" <vnality@.msn.com> ha scritto nel messaggio news:OVirIejtEHA.1332@.TK2MSFTNGP10.phx.gbl...
> DOES SETTING NOCOUNT ON option affect my stored procedures and website
> performance in anyway within my asp.net application?
>
> When and when not to set SET NOCOUNT ON?
>
> I know what it does but not exactly where and when I want to use it.
>
> i.e.
> CREATE PROCEDURE GetAuthorization 2.0
> @.Username Varchar( 20 ),
> @.Password Varchar( 16 )
> as
> SET NOCOUNT ON
> declare @.AccountID int
>
> set @.AccountID = -1
> select @.AccountID =
> case
> when Password = @.Password and Active = 1 then AccountID
> when Password = @.Password then -2
> else -3
> end
> from Account
> where Username = @.Username
>
> return @.AccountID
> go
>
>

Set Request.ContentEncoding from code?

Hi Ricky,
From your description, you have met some problem manually setting the
Request's ContentEncoding in ASP.NET via code at runtime, you found it only
works when you specifying them in web.config however what you want it set
different value for each comming request rather than all the same in
web.config , yes?
As for this problem, here are my understanding and suggestions:
The Request/Response 's ContentEncoding set in web.config's Globalization
section is the default setting for the asp.net webapplication. Generally
the comming webrequest is using the encoding from the client(default
setting in browser), if there is no from client, the default setting in
web.config will be used. And also, the Asp.net 's Request and Response
object ContentEncoding can help use manually set them via code. And the
Response's ContentEncoding is nothing particular that we can just set it
before the response content return to client. However, the Request's
ContentEncoding will be a bit different , because when the request comming
, the asp.net runtime will soon checking the ContentEncoding (from client ,
if not, use the default in web.config), So if we set it later in Page's
processing life cycle, it's too late. We must set it before the request is
being processing. In ASP.NET there're several Events during each request's
processing , such as BeginRequest, AuthenticateRequest, EndRequest ...
And the "BeginREquest" is exactly the one we have to use, you can hook this
event in the application 's Global object(Global.asax.cs) or make a custom
HttpModule to handle it. Here are some related reference in MSDN:
#HttpApplication.BeginRequest Event
http://msdn.microsoft.com/library/e...mwebhttpapplica
tionclassbeginrequesttopic.asp?frame=true
#Custom HttpModule Example
http://msdn.microsoft.com/library/e...tomhttpmodules.
asp?frame=true
Also, following is a former thread discussing on a similiar issue, you may
also have a look:
#query string encoding/decoding
http://groups.google.com/groups?hl=...hreadm=PLNLjDdA
EHA.1288%40cpmsftngxa06.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3
DUTF-8%26oe%3DUTF-8%26q%3Dquerystring%2Bsteven%2Bcheng
Hope helps. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspxThanks for you reply Steven. It works just fine setting the
Request.ContentEncoding in the Application BeginRequest event.
Now my only trouble is how do I select the right encoding for the Request?
Please let me elaborate:
1. I have a RequestHandler that serves content using diffrent encoding. So
when a danish page is being served the "ISO-8859-1" encoding is used by
setting the Response.ContentEncoding property accordingly.
2. The problem occurrs when a user submits form data from a page using
encoding other than the default defined in web.config (usually "utf-8").
Since the request is always beeing decoded using the defaut encoding this
results in characters beeing lost in the process.
3. The solution is to set the Request.ContentEncoding in the Application
BeginRequest event. But how do i know what encoding to use in this context?
Are there any way to tell which encoding the browser used when sending the
request?
Since I have to tell the browser which encoding to use in both the HTTP
Header and the HTML Content-Type Meta tag, the least it could do was to
return the favour and tell me which encoding it used when POSTing data to
me.
Thanks for your time,
Ricky
Hi Ricky,
Thanks for your followup. As for the new question, here are my
understandings:
Generally, all the infos we can ge from the client are all set in the Http
Request 's Header area , the Request object's
UserAgent, Request.ContentType,Request.Browser... etc
We can use the following code to loop through the comming request's header
collection:
foreach(string key in Request.Headers.Keys)
{
Response.Write("<br>"+key+ " : " + Request.Headers[key]);
}
There are some optional items such ad
ACCEPT-LANGUAGE
ACCEPT-ENCODING
ACCEPT-CHARSET
which indicate what kind of language/encoding type / charset the client
browser support. But I've not found anything which directly tell us what
kind of encoding the clieht is using. I think this is determined by the
client machine's OS. And for those new OS such as NT or XP which support
unicode will automatically use the UTF-8 or the certain charset
/contenttype from the serveside when first time getting the page from
server. I think on those old OS such as win98 which doesn't use Unicode may
have different behavior, you may have a test.
Also, you can use the above means to loop the Request's header collection
to see whether there is anyitem which is useful for your determination of
the contentEncoding to change in BeginRequest. If not, I'm afraid we
haven't any means to get anyother clientside's info so far.
Please have a check and if you have any questions, please feel free to post
here. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Ricky,
Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Steven,
Please forgive me for forgetting to write back with an update on my issue.
I tried looking at the Request object and the informatin found in the
Headers collection, but it provided me with no usefull information when
deciding what encoding should be applied to it.
The most usefull header must be the ACCEPT-CHARSET, but IE never provided me
with this one and Mozilla only returned a list of supported encoding
formats.
I guess this proves that you can't really use multiple encodings on one
ASP.NET application.
Cause as soon as you set the Response Encoding you'll need to decode
subsequent requests as well by applying the right ContentEncoding. And since
this can only be done in the Applications BegingRequest event (before any
process of the request, and creation of session) you'll have no idea what
encoding to use.
I'm still a bit frustrated about it, but for know my solution has been to
duplicate my ASP.NET application to multiple IIS websites and then applied
diffrent encoding to each of these by setting it in the web.config. Anyone
should be able to see that this is a bad solution.
Thanks for your time,
Ricky
Hi Ricky,
Thanks for the followup. Generally all the existing browsers won't send the
content-encoding header in request , some will send the ACCEPT-CHARSET but
which have nothing to do with the actual request or response's content. And
there also nothing on the contentencoding in the W3C's http specification.
So the problem is exising on all the browsers since the browser will
encoded the posted request's content. Here is a certain http1.1 content
encoding reference:
http://i4net.tv/marticle/mod_gzip/encoding.htm
Also, since the UTF-8 is currently the most widely used encoding type which
can represent all the datas from different district. So most browser and
serverside web application use this as the default encoding to process the
request's content. Anyway, I'll consult some further experts to see whether
they have any ideas on this issue and will update you if I got any addition
infos. Thanks.
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Ricky,
Regarding on the problem, I'm still consulting and will update you as soon
as possible. Thanks for your understanding.
Regards,
Steven Cheng
Microsoft Online Support
Hi Ricky,
I'm sorry for keeping you waiting for so long time. After further
consulting on some experts, they also confirm that the standard request
dosn't contain such a field which represent the request data's encoding
charset. And we could not get the exactly encoding charset from any header
items but looking at the bytes. And they also suggest that the
ACCEPT- LANGUAGES header is helpful on determining the encoding charset to
use, just check this value in BeginRequest event and set the appropriate
ContentEncoding. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx