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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Urgent requirement form post valuesUrgent requirement form post values
Previous
 
Next
New Post
7/25/2008 10:58 AM
 

Hi All,

     please help regarding this issue

      I am developing a DNN Module which has several links and can be redirected to the corresponding site  when clicked on the link. There are different Types of links displayed based on the settings. Types of Links are Normal Text Link (where a text desc is given and the url is typed for which it has to be redirected) and there will an image displayed instead of Text desc and for this also there will be url given for which it has to be redirected to also we can pass the parameters which are also defined and the format for the url will be given like this (http://www.xyz.com?{Tag1}={Tag2}) where the values of tag1 and tag2 are also defined. I amable to do it through navigate url perfectly.

By placing place holders and setting the visible conditions in the temlate column i am able to do it

 The problem  is now i have another link type http post where the url format is given similarily but the thing is parameters should not be visible here since it must be done through post method. How can i achieve this . i sat on it since last 2 days with no success. Please provide some sample code on how to achieve this. I can retrieve the parameters and url successfully on click event of the link through databind i have called this But how can i redirect it please provide some sample code

I am posting my code here to give you a better idea

My Datagrids template column has the following

   <asp:TemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                <Itemtemplate>
                      <asp:PlaceHolder ID="PlaceHolder9" runat="server" Visible='<% # IIf((Eval("LinkType") = 3 and (Eval("RedirectId") =  rue)),true,false)%>'>
                       <asp:ImageButton Runat="server" ID="lnkHttpPost" OnCommand="lnkHttpPost_Command" ImageUrl='<% #Eval("ImagePath") %>' style="border:0px" CommandName='<%# DataBinder.Eval(Container, "DataItem.UrlId")%>' />
                    </asp:PlaceHolder>
                </ItemTemplate>
           </asp:TemplateColumn>

 

And my code behind file has the following

  Protected Sub lstUrls_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles lstUrls.ItemDataBound
            Dim lnkDeleteUrl As ImageButton
            lnkDeleteUrl = CType(e.Item.FindControl("lnkDeleteUrl"), System.Web.UI.WebControls.ImageButton)
            If Not lnkDeleteUrl Is Nothing Then
                ClientAPI.AddButtonConfirm(lnkDeleteUrl, Localization.GetString("DeleteItem.Text", LocalResourceFile))
            End If

            Dim lnkHttpPost As ImageButton
            lnkHttpPost = CType(e.Item.FindControl("lnkHttpPost"), System.Web.UI.WebControls.ImageButton)
        End Sub

  Protected Sub lnkHttpPost_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
            postUrl(e.CommandName)
        End Sub

      Sub postUrl(ByVal UrlId As Integer)
            If Not Null.IsNull(UrlId) Then
                Dim Tag, TagValue As String
                Dim objGetUrl As RedirectInfo
                objGetUrl = RedirectController.GetRedirectUrl(UrlId)
                Dim HttpPostImagePath As String
                HttpPostImagePath = objGetUrl.URLformat
                While objGetUrl.URLformat.IndexOf("{") > 0 AndAlso objGetUrl.URLformat.IndexOf("}") > objGetUrl.URLformat.IndexOf("{")
                    Tag = objGetUrl.URLformat.Substring(objGetUrl.URLformat.IndexOf("{") + 1, objGetUrl.URLformat.IndexOf("}") - objGetUrl.URLformat.IndexOf("{") - 1)
                    TagValue = GetTagValue(Tag)
                    objGetUrl.URLformat = objGetUrl.URLformat.Replace("{" & Tag & "}", TagValue)
                End While

                Dim MainString As String = objGetUrl.URLformat
                Dim Split As String() = MainString.Split(New Char() {"?"})
                posturlstring = Split(0)
                postparameters = Split(1)

where posturl  gets the website url (http://www.xyz.com) and post params gets the parameters based on values like (option=com_content&viewid=23) etc

I have written it like this can anybody please help on this i need it really quickly

Thanks,

Sandeep.M

 

 
New Post
7/31/2008 12:43 PM
 

Try

 

 

Dim selUrl As String = DotNetNuke.Common.Globals.NavigateURL(54) ' This is the url you want to post to
        Dim uri As New Uri(selUrl)
        Dim data As String = "option=com_content&viewid=23" 'This is the post data you specify it just like get
        If uri.Scheme = uri.UriSchemeHttp Then
            Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(uri)
            request.Method = System.Net.WebRequestMethods.Http.Post
            request.ContentLength = data.Length
            request.ContentType = "application/x-www-form-urlencoded"

            Dim writer As New IO.StreamWriter(request.GetRequestStream)
            writer.Write(data)
            writer.Close()

            Dim oResponse As System.Net.HttpWebResponse = request.GetResponse()
            Dim reader As New IO.StreamReader(oResponse.GetResponseStream())
            Dim tmp As String = reader.ReadToEnd()
            oResponse.Close()

            Response.Write(tmp)
        End If
The requested url will be able to access them using

Request.form(

"option") & Request.form("viewid")

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Urgent requirement form post valuesUrgent requirement form post values


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