In my application programmatically i need to change the zone of alternate access mapping url
i am able to get alternate access mapping url of webapplication but not able to change zone,i getting an error "Property or indexer 'Microsoft.SharePoint.Administration.SPAlternateUrl.UrlZone' cannot be assigned to -- it is read only"
below is code i tried till now:
SPWebApplication owebapp = SPContext.Current.Site.WebApplication;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
foreach (SPAlternateUrl altUrl in owebapp.AlternateUrls)
{
if (altUrl.UrlZone == SPUrlZone.Default)
{
//altUrl.UrlZone = SPUrlZone.Internet;
//owebapp.Update();
string incomingURL = altUrl.IncomingUrl;
string publicurl = SPUtility.AlternateServerUrlFromHttpRequestUrl(altUrl.Uri).AbsoluteUri;
}
}
});I searched in net but didn't find any solution,
Please do let me know if any way i can update Alternate access mapping zone.
Note : i know we can do it using power shell , but i need to do using c# code.