Archive

Archive for October, 2014

Testing WCF Service using Test Client

October 12, 2014 Leave a comment

Hi all,

Try this example for Testing WCF service using Test Client

1- Create a WCF service.

2- Now it’s time to test our service. Instead of creating a console application or a client application to test the service we will use the predefined tool wcftestclient.exe.

3- Open Visual Studio command prompt and type wcftestclient then Enter.

wcftestclient1

4- After pressing Enter, we get a GUI application of the WCF Test Client

wcftestclient2

5- Select File->Add Service and type the service endpoint url as address and click ok.

wcftestclient3

We get as below

wcftestclient4

6- Double click on the Method that you want to test

wcftestclient5

7- Now pass the value and click on Invoke button and you will get the response below.

wcftestclient6

Hope this helps

Good Luck.

Advertisements
Categories: ASP.Net

Solution for “Access denied by Business Data Connectivity” Error

October 10, 2014 Leave a comment

If you are trying to create external data type list and get the error “Access Denied by Business Data Connectivity” then the most common reason for that can be the incorrect permissions for your target External Content Type. To fix the issue, please perform the following steps:

1- Open your SharePoint 2010 Central Administration Page
2- Under Application Management, click Manage service applications
3- Click Business Data Connectivity Service link
4- List of all external content types will be displayed, select your target external content type by checking it
5- Click Set Object Permissions on Ribbon
6- “Set Object Permissions” dialogue box will be displayed, add yourself or any other users, as you want
7- Check at least Selectable in client permission in permissions list
8- Click OK to save your changes
Now try to view your external content types list and Bingo! there will be no more “Access denied by Business Data Connectivity” error message!

Categories: SharePoint 2010

Allow and Enable Anonymous Users Access In SharePoint 2010 Sites

October 10, 2014 Leave a comment

Hi all,

try this example to Allow and Enable Anonymous Users Access In SharePoint 2010 Sites

1. Open SharePoint 2010 Central Administration, Go to Manage Web Applications

A1

2- Select Your Site and click on Authentication Providers icon in the top ribbon bar

A2

3- Click on Default Zone and Check the Enable Anonymous Access CheckBox and save it

A4

A3

4- Select your site and click on Anonymous Policy Icon In ribbon

A5

5- Select Default Zone from dropdown and select the permissions option you want to grant to anonymous users Selecting None – No Policy is recommended )

A6

6- Close Central Administration and open your site collection in browser with administrator account (Site for which you just had set anonymous access)

Click on Site Actions and select Site Permissions

A7

7- Click on Anonymous Access Icon on the top ribbon

A8

8- Select Entire Web Site Option and click on OK

A9

9- Now you can browse your site Anonymously without login.

A10

Hope this helps

Good Luck.

Categories: SharePoint 2010

Copy Database With Data – Generate T-SQL For Inserting Data From One Table to Another Table

October 9, 2014 Leave a comment

Hi all,

Try this example to Copy Database With Data – Generate T-SQL For Inserting Data From One Table to Another Table

In our example, we will just take one table for convenience.

1- Open MS SQL Server 2008

2- Right Click on Database >> Tasks >> Generate Scripts >>

data1

3- This will pop up Generate SQL Server Scripts Wizards >> Click on Next >> Select Database >> This will bring up a screen that will suggest to Choose Script Option.

data2

data3

4- On Choose Script Option Screen of Script Wizard under section Table/View Options Look at Script Data row and Turn the Option to True.

data4

5- The Next Screen will ask about object types. Select all the objects that are required in the generated script. Depending on the previous screen it will show few more screen requesting details about the objects required in script generation.

data5

data6

6- On the very last screen it will request output options. Select the desired output options of Script to file, Script to Clipboard or Script New Query Window.3

data7

7- Clicking on Finish button will generate a review screen containing the required objects along with script generating data.

data8

data9

8- Clicking on Finish button one more time will generate the requested output.

data10

Hope this helps

Good Luck.

Categories: SQL Server

Get Client Location (Latitude and Longitude) using Google Maps API and Save to Database

October 8, 2014 6 comments

Hi all,

try this example to Get Client Location (Latitude and Longitude) using Google Maps API and save to database

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<script src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
document.getElementById("<%=hfLat.ClientID %>").value = latitude;
document.getElementById("<%=hfLon.ClientID %>").value = longitude;
var coords = new google.maps.LatLng(latitude, longitude);
var mapOptions = {
zoom: 15,
center: coords,
mapTypeControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(
document.getElementById("mapContainer"), mapOptions
);
var marker = new google.maps.Marker({
position: coords,
map: map,
title: "Your current location!"
});

});
} else {
alert("Geolocation API is not supported in your browser.");
}
</script>
<style type="text/css">
#mapContainer
{
height: 500px;
width: 800px;
border: 10px solid #eaeaea;
}
</style>
<div id="mapContainer">
</div>
<asp:HiddenField ID="hfLat" runat="server" />
<asp:HiddenField ID="hfLon" runat="server" />
<asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
</form>
</body>
</html>

In Code behind :

protected void btnSave_Click(object sender, EventArgs e)
{
string latitude = hfLat.Value;
string longitude = hfLon.Value;

//Save to database here
}

Hope this helps

Good Luck.

Categories: ASP.Net