Geeks With Blogs

News These postings are provided "AS IS" with no warranties, and confers no rights.
Locations of visitors to this page virtusa corp sharepoint virtusa.com shehan peruma

Shehan Peruma

Quite simple really :)

  1. Open up an existing DVWP or create one.
  2. Right click the DVWP and select ‘Common Data View Tasks’ (or click the little arrow that appears on the top right of the DVWP)
  3. Click the ‘Parameters’ link
  4. In the dialog that opens up click the ‘New Parameter’ button.
  5. Provide a name for the parameter (e.g. IPAddress)
  6. In the ‘Parameter Source’ dropdown select ‘Server Variable’
  7. In the ‘Server Variable Name’ text box enter REMOTE_ADDR
  8. Leave the ‘Default Value’ text box empty
  9. Click OK
  10. Now switch to the code view and go to the place where you want the IPAddress to appear and type the following:
  11. <xsl:value-of select="$IPAddress" />

     

    Thats it! Save and open the page containing the DVWP and it should show you you’re IPAddress. I’ve only been able to test it on the intranet and it works fine. If you want to display values of other server variables you can add more parameters and provide the appropriate variable name.

    Here’s a list of server variables: http://www.w3schools.com/asp/coll_servervariables.asp

     

Posted on Wednesday, October 14, 2009 9:20 PM SharePoint Designer , Development | Back to top


Comments on this post: Display the users IP Address in a Data View Web Part

# re: Display the users IP Address in a Data View Web Part
Requesting Gravatar...
Thanks so much for this! We've started using Sharepoint for our intranet and I've been searching for a way to to show the users ip address on a help desk ticketing system. Now... Is there any way to grab the ip address and pass it on to a workflow email?

Thanks,

Jeff
Left by Jeff Bolin on Nov 18, 2010 9:23 PM

# re: Display the users IP Address in a Data View Web Part
Requesting Gravatar...
Jeff,

1. in the HelpDesk site Create a new column (I labeled it "Captured IP"
2. For all the following use Sharpoint designer: copy the "Newform.aspx" to a new form (I used "newrequestform.aspx")
3. Remove the DataFormWebPart
4. Insert new "custom list form" (Insert>Sharepoint controls>Custom List Form).
5. find the form part bound to the "captured IP", and in the common form filed tasks change the "format as" from "List Form field" to "text box"
6. Ensure you have inserted the parameters as specified above as the next step will not work if you don't have the parameter in...
7. The line of code for that field should look something like:
<asp:TextBox runat="server" id="ff#{$Pos}" text="{@Captured_x0020_IP}" __designer:bind="{ddwrt:DataBind('i',concat('ff#',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Captured_x0020_IP')}" />
8. after the "Text" property, insert the following code: Value="{$IPADD}" (use whatever parameter name you used when you created the parameter in place of IPADD) so the code looks like: <asp:TextBox runat="server" id="ff#{$Pos}" text="{@Captured_x0020_IP}" Value="{$IPADD}" __designer:bind="{ddwrt:DataBind('i',concat('ff#',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Captured_x0020_IP')}"
9. Now that the field is there and prefilled - you can make the height and width "0" so that the users can't see or modify but the system still sees it and posts it to the new request.
10. Change the "Add new item" selection within "supporting files" (within the properties of the "Service Request" folder) to reflect your new form.
11. With the "Captured IP" a data field of your service requests, you can do a standard lookup within the workflow...
Left by Richard on Jan 03, 2013 6:56 AM

# re: Display the users IP Address in a Data View Web Part
Requesting Gravatar...
Hi there,

I really need to get user's IP address and use it in InfoPath form (for instance) but I am not pretty good with the SP designer. Would you mind to describe the upper procedure with some screen shots. I (and all SP noobs) would be very grateful. Thanks in advance!
Left by George on Jan 08, 2013 1:51 AM

# re: Display the users IP Address in a Data View Web Part
Requesting Gravatar...
Works Like a charm...simple and i can use this to redirect the site based on IP's.
Left by Siddharth on Jul 30, 2014 7:48 PM

Your comment:
 (will show your gravatar)


Copyright © shehan | Powered by: GeeksWithBlogs.net | Join free