Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesPOST form data from dnnPOST form data from dnn
Previous
 
Next
New Post
12/17/2010 7:17 PM
 
Hi

I'm trying to build a module to send some parameters AND redirect the user to a payment gateway. The gateway requires POST parameters.
I can't find an easy way to accomplish this in DNN. I think it would be very simple with HTML. But I'm on the learning curve with c# and can't find a simple solution.  Ideally I want to build a user control that I can use elsewhere. I have no problem with the control but can't work out a POST with redirect.

Can anyone offer some pointers or code examples?

thanks
Gus

"if the only tool you have is a hammer you tend to see every problem as a nail" http://www.carawaydesign.com
 
New Post
12/18/2010 11:49 AM
 
I found some example code which I modified and finally got to work, from here:
http://www.codeproject.com/KB/aspnet/ASP_NETRedirectAndPost.aspx?msg=3703198#xx3703198xx

But I ran into a problem with this error:

"The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."

After much struggling I found out that in the DNN Default.aspx there is some code:

 <%= HtmlAttributeList %>>

which I removed and the error went away.

Does anyone know what this line above does and if it's needed or not? How do others solve the problem of POST with redirect from DNN?

thanks Gus

"if the only tool you have is a hammer you tend to see every problem as a nail" http://www.carawaydesign.com
 
New Post
12/19/2010 6:15 PM
 

Hi,

You cannot change the controls once the server has served your page. Once you do a remote post you have the client (browser) redirected to the gateway. In the url you have actually no critical data. This data is in the form itself and thus more secure than if a url would be intercepted. You can code something like below and have it executed on any control. It will end the response to the server and then redirect to the payment gateway.

J.

        /// <summary>
        /// Post the current values to the specified URL. The values will be written as hidden fields.
        /// </summary>
        public void Post()
        {
            //Build the used form.
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write("<html><Head></Head>");
            HttpContext.Current.Response.Write(string.Format("<body onload=\"document.{0}.submit()\">", mFormName));
            HttpContext.Current.Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", mFormName, mMethod, mUrl));

            for (int i = 0; i < mInputs.Keys.Count; i++)
            {
                HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", mInputs.Keys[i], mInputs[mInputs.Keys[i]]));
            }
            HttpContext.Current.Response.Write("</form>");
            HttpContext.Current.Response.Write("</body></html>");
            HttpContext.Current.Response.End();          
        }
 
New Post
1/11/2011 8:02 AM
 
thanks for the help

I was under the cosh to deliver so I never got back to respond. Sorry about that.

I solved the problem when using the example in this article:

http://www.vbdotnetheaven.com/Uploadfile/desaijm/ASPNetPostURL11112005054933AM/ASPNetPostURL.aspx

"if the only tool you have is a hammer you tend to see every problem as a nail" http://www.carawaydesign.com
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesPOST form data from dnnPOST form data from dnn


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out