Hi,
What's the test result? Can it work?
Regards,
Allen Chen
Microsoft Online Support
--------------------
| From: "WT" <WT@newsgroups.nospam>
| References: <5A**********************************@microsoft.co m>
<Ft**************@TK2MSFTNGHUB02.phx.gbl>
<8B**********************************@microsoft.co m>
<Sp**************@TK2MSFTNGHUB02.phx.gbl>
| In-Reply-To: <Sp**************@TK2MSFTNGHUB02.phx.gbl>
| Subject: Re: ControlAdapter sample from Scott Gu no more work ?
| Date: Fri, 26 Sep 2008 11:55:38 +0200
| Lines: 275
| Message-ID: <CB**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| format=flowed;
| charset="iso-8859-1";
| reply-type=original
| Content-Transfer-Encoding: 8bit
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049
| X-MS-CommunityGroup-PostID: {CBD0FA70-47EA-4A4D-9B82-3307BB0F35BE}
| X-MS-CommunityGroup-ThreadID: 5AE30215-24F1-48F9-B9EC-16707DAD2F45
| X-MS-CommunityGroup-ParentID: B24F20C7-BA52-4E25-90DF-BC3FD5520FF2
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:76777
| NNTP-Posting-Host: TK2MSFTNGHUB02.phx.gbl 127.0.0.1
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Yes I am using the 3.5 SP1.
| I try your code and give a feed-back, thanks.
| CS
|
| "Allen Chen [MSFT]" <v-******@online.microsoft.coma écrit dans le
message
| de news:Sp**************@TK2MSFTNGHUB02.phx.gbl...
| Hi,
| >
| I believe the change what Bruce mentioned is in the .NET 3.5 SP1. Are
you
| using .NET 3.5 SP1?
| >
| Actually the Action property is a shortcut to set/get the action
| attribute.
| We can confirm it with the source code below:
| >
| public string Action
| {
| get
| {
| string str = base.Attributes["action"];
| if (str == null)
| {
| return string.Empty;
| }
| return str;
| }
| set
| {
| base.Attributes["action"] =
| HtmlControl.MapStringAttributeToString(value);
| }
| }
| >
| >
| I tried Scott's project in Visual Studio 2008 SP1, it still works. Could
| you try it again and paste the form tag here? The behavior on my side
is:
| >
| 1. Default.aspx:
| <form name="form1" method="post"
| action="/UrlRewrite_HttpModule1/Default.aspx" id="form1">
| >
| 2. I clicked "Books" link to view Products.aspx:
| <form name="form1" method="post"
| action="/UrlRewrite_HttpModule1/Products/Books.aspx" id="form1">
| >
| Regards,
| Allen Chen
| Microsoft Online Community Support
| >
| --------------------
| | From: "WT" <WT@newsgroups.nospam>
| | References: <5A**********************************@microsoft.co m>
| <Ft**************@TK2MSFTNGHUB02.phx.gbl>
| | In-Reply-To: <Ft**************@TK2MSFTNGHUB02.phx.gbl>
| | Subject: Re: ControlAdapter sample from Scott Gu no more work ?
| | Date: Thu, 25 Sep 2008 16:46:52 +0200
| | Lines: 168
| | Message-ID: <8B**********************************@microsoft.co m>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | format=flowed;
| | charset="iso-8859-1";
| | reply-type=original
| | Content-Transfer-Encoding: 8bit
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049
| | X-MS-CommunityGroup-PostID: {8B1FCBF4-9ECC-4A44-AC55-8EC6E11003AA}
| | X-MS-CommunityGroup-ThreadID: 5AE30215-24F1-48F9-B9EC-16707DAD2F45
| | X-MS-CommunityGroup-ParentID: FED06D18-3C27-46FE-A8F1-D1E348B75CFC
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | Path: TK2MSFTNGHUB02.phx.gbl
| | Xref: TK2MSFTNGHUB02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:76742
| | NNTP-Posting-Host: TK2MSFTNGHUB02.phx.gbl 127.0.0.1
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | Thanks,
| | Have you seen message from Bruce ?
| |
| | Regards
| | CS
| | "Allen Chen [MSFT]" <v-******@online.microsoft.coma écrit dans le
| message
| | de news:Ft**************@TK2MSFTNGHUB02.phx.gbl...
| | Hi,
| | >
| | I've tested Scott's project:
| | >
http://www.scottgu.com/blogposts/url...ttpModule1.zip
| | >
| | It works fine. Could you try it again to see if it works? Firstly
| please
| | view the page Default.aspx. Then click a link on the page to view
| | Products.aspx. View source of Products.aspx and you will see the
| action
| | attribute in the form tag:
| | <form name="form1" method="post" action="/SOS/Products.aspx"
| id="form1">
| | >
| | Regards,
| | Allen Chen
| | Microsoft Online Support
| | >
| | Delighting our customers is our #1 priority. We welcome your
comments
| and
| | suggestions about how we can improve the support we provide to you.
| Please
| | feel free to let my manager know what you think of the level of
| service
| | provided. You can send feedback directly to my manager at:
| |
ms****@microsoft.com.
| | >
| | ==================================================
| | Get notification to my posts through email? Please refer to
| | >
| >
http://msdn.microsoft.com/en-us/subs...#notifications.
| | >
| | Note: The MSDN Managed Newsgroup support offering is for non-urgent
| issues
| | where an initial response from the community or a Microsoft Support
| | Engineer within 1 business day is acceptable. Please note that each
| follow
| | up response may take approximately 2 business days as the support
| | professional working with you may need further investigation to
reach
| the
| | most efficient resolution. The offering is not appropriate for
| situations
| | that require urgent, real-time or phone-based interactions or
complex
| | project analysis and dump analysis issues. Issues of this nature are
| best
| | handled working with a dedicated Microsoft Support Engineer by
| contacting
| | Microsoft Customer Support Services (CSS) at
| | >
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| | ==================================================
| | This posting is provided "AS IS" with no warranties, and confers no
| | rights.
| | >
| | --------------------
| | | From: "WT" <WT@newsgroups.nospam>
| | | Subject: ControlAdapter sample from Scott Gu no more work ?
| | | Date: Wed, 24 Sep 2008 18:42:32 +0200
| | | Lines: 85
| | | Message-ID: <5A**********************************@microsoft.co m>
| | | MIME-Version: 1.0
| | | Content-Type: text/plain;
| | | format=flowed;
| | | charset="iso-8859-1";
| | | reply-type=original
| | | Content-Transfer-Encoding: 7bit
| | | X-Priority: 3
| | | X-MSMail-Priority: Normal
| | | X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
| | | X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049
| | | X-MS-CommunityGroup-MessageCategory:
| | {E4FCE0A9-75B4-4168-BFF9-16C22D8747EC}
| | | X-MS-CommunityGroup-PostID: {5AE30215-24F1-48F9-B9EC-16707DAD2F45}
| | | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | | Path: TK2MSFTNGHUB02.phx.gbl
| | | Xref: TK2MSFTNGHUB02.phx.gbl
| | microsoft.public.dotnet.framework.aspnet:76663
| | | NNTP-Posting-Host: TK2MSFTNGHUB02.phx.gbl 127.0.0.1
| | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| | |
| | | Hello,
| | |
| | | Using url rewritting and ajax.net, I tried to circumvent some
| potential
| | | problems with postback url using a code from a sample given by
| Scott.
| | | The idea is to use a control Adapter on htmlform to catch the
| attribute
| | | 'action' wich contains the url where the post will occur and
replace
| it
| | with
| | | a safe url.
| | | Unfortunately, it doesn't works, does something has changed with
| | framework
| | | 3.5 used by vs2008 ?
| | | From the trace I put inside I can see that the adapter is working
| but
| I
| | | never get an attribute named action ????
| | |
| | | Here is the code:
| | |
| | | public class FormRewriterControlAdapter : ControlAdapter
| | | {
| | | protected override void
Render(System.Web.UI.HtmlTextWriter
| | writer)
| | | {
| | | base.Render(new RewriteFormHtmlTextWriter(writer));
| | | }
| | | }
| | |
| | | public class RewriteFormHtmlTextWriter : HtmlTextWriter
| | | {
| | | public RewriteFormHtmlTextWriter(HtmlTextWriter writer)
| | | : base(writer)
| | | {
| | | InnerWriter = writer.InnerWriter;
| | | }
| | |
| | | public RewriteFormHtmlTextWriter(TextWriter writer)
| | | : base(writer)
| | | {
| | | InnerWriter = writer;
| | | }
| | |
| | | /// <summary>
| | | /// If the attribute we are writing is the "action"
| attribute,
| | and
| | | we are not on a sub-control,
| | | /// then replace the value to write with the raw URL of
the
| | | request - which ensures that we'll
| | | /// preserve the PathInfo value on postback scenarios
| | | /// </summary>
| | | public override void AddAttribute(string name, string
value,
| | bool
| | | fEncode)
| | | {
| | | HttpContext Context =
| | | HttpContext.Current;
| | | if ( name.Equals("action") )
| | | {
| | | if (Context != null &&
| | Context.Items["ActionAlreadyWritten"]
| | | == null)
| | | {
| | | value =
| | | Context.Request.RawUrl;
| | | // Indicate that we've already rewritten the
| | <form>'s
| | | action attribute to prevent
| | | // us from rewriting a sub-control under the
| <form>
| | | control
| | | Context.Items["ActionAlreadyWritten"] =
| true;
| | | }
| | | }
| | | base.AddAttribute(name, value, fEncode);
| | | }
| | |
| | | }
| | |
| | | I have also a special declaration in my web site Form_Browsers
| folder
| | |
| | | <browsers>
| | | <browser refID="Default">
| | | <controlAdapters>
| | | <adapter controlType="System.Web.UI.HtmlControls.HtmlForm"
| | |
adapterType="AddonNice.Core.UI.Adapters.FormRewrit erControlAdapter"
| />
| | | </controlAdapters>
| | | </browser>
| | | </browsers>
| | |
| | |
| | |
| | | Thanks to any help on this, it is so simple that the error must be
| | | evident.....but.
| | |
| | | CS
| | |
| | |
| | >
| |
| |
| >
|
|