How to enable IP Address and Domain Restrictions in Windows 7

by Naveen 7. February 2011 07:20

After I wrote my post on How to block or unblock IP address in IIS programatically using .Net, I got few questions from users about having some difficulty on Windows 7. All the questions were related to the following line of code.

var ipSecuritySection = hostConfig.GetSection("system.webServer/security/ipSecurity", site);

GetSection method was either returning null object or throwing exception. This indicated that the specified section did not exist in IIS configuration on the machine. And there is a valid reason for it. On Windows 7, IPSecurity section is not enabled in IIS. First indication of this problem is that you will not see IP Address and Domain Restrictions icon in IIS feature view in IIS management console.

IIS IP Address and Doamin Restrictions

Goto Console Panel > Programs > Turn windows features on or off panel. Under IIS > World Wide Web Services > Security you will find IPSecurity section that is not checked. Check it and apply the change and then you should be all set.

 

Views: 2293

Tags:

IIS | Windows 7 Phone

How to fix HTTP Error 401.3 - Unauthorized error

by Naveen 19. October 2010 03:12

Other day I was installing a DotnetNuke site on Windows 2008 R2 server. I followed all the usual steps of creating a new web site in IIS7.5 on Windows 2008. When I tried to access the site, I ended up with the following error.

HTTP Error 401.3 - Unauthorized

You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

In the past I had run into this problem and I knew that it has something to do with application pool and accounts associated with that pool. The error message clearly tells that it has something to do with file permissions on the folder where the web site was physically present. Here are some of the common causes of this sort of error when you configure a new web site on Windows 2008 IIS7.5.

Check Application Pool

Most important is that you need to check what Application Pool is being used for your site and make sure that that account being used by that pool has appropriate access rights on the folders and files. In Windows 2008 R2 there are some important changes related to accounts that are used for IIS application pools. Most of us who come to Windows 2008 R2 environment, get stumped by the fact that it may not be Network Service account that is used for your web site process.

First thing first, we need to figure out what application pool we are using and how we can change it. Here are my earlier posts where I described these steps.

Security Account Used By Application Pool

This piece of information is at heart of solving the error with access control list. When you bring up advanced settings dialog box for the application pool, you will find the following value that tells you the account used by your application pool.

Select the button next to that name and it will bring up following diaolog box where you can change the account settings for your pool identity. You can select system defined accounts from the dropdown or you can select a custom account that you have created for your site.

Diagnosing The Error

So far I have discussed cause and remedies of the error that you got. Now let's see how you can diagnose the issue to really find out what account was trying to access the site files that ended up in access denied error.

I always keep my super tool Process Monitor tool handy on all my development as well as production servers. You can download it from SysInternals site. Fir it up and acces the site. After you get the error, capture the trace and then look for ACCESS DENIED error. I will not go into details about how to effectively use this tool with filters and all to get to the correct information quickly. There you will be able to see windows account that was trying to access the files. Now you can go to site fclder and configure appropriate access rights for the account and you are good to go!

 

Views: 7204

Tags:

Windows 7 Phone | IIS | Windows 2008 | Windows 7 Phone

How to configure Application Pool in IIS in Windows 7

by Naveen 18. October 2010 06:47

In earlier post I discussed how to find application pool of your web site or web application in Windows 7 and Windows 2008. Next set of questions that I get asked right off the bat are:

  • Where are all applicaton pool in IIS in Windows 7 and Windows 2008?
  • How to change settings of an application pool in IIS in Windows 7 and Winds 2008?

Here is step by step procedure to find what all application pools you have in IIS7.

  • Start IIS Manager console.

  • Look in the tree in left hand side pane. There you will find a node named Application Pools. Click on this link.

  • In the center pane, you will see list of all application pools that have been create on your machine.

  • Select the pool that you want to inspect or configure. In the right hand pane you will find the list of actions that you can perform on the pool.

  • Click on Advanced Settings to all the details of your application pool configuration. This is where you can make changes to pool configuration.

 

Views: 4954

Tags:

IIS | Windows 2008 | Windows 7 Phone

How to find Application Pool Of web site on Windows 7

by Naveen 18. October 2010 06:21

In IIS7 and higher one of crucial points in web site configuration is Application Pool. A lot of developers who are new to IIS7 and higher IIS management console, ask a very basic question, How do I find Application Pool for the site?. Here is answer to this question.

  • Bring up IIS Managager console from Administrative tools.

  • Select the web site or web application, for which you find to configure Application Pool, in left hand side pane.

  • In the right hand side pane, click on Basic Settings link.

  • It will bring up following view, where you can see your application pool for your web application.

  • Click on Select button if you want to see all the pools that are available to you. This is where you can change Application Pool for your application.

 

Views: 3685

Tags:

IIS | Windows 2008 | Windows 7 Phone

Windows 7 Phone Tethering Not Available

by Naveen 30. September 2010 18:20

I was so looking forward to going full throttle into Windows 7 Phone application development. I had my application account all created and had some some cool ideas about some Silverlight applications for the phone. And then came the bad news. Microsoft will not support tethering on Windows 7 Phone for October release. I know it was going to be a typical Microsoft V1.0 release of any software or hardware. But I was willing to try when Microsoft has been telling that tethering will be supported. Oh well, so much for my excitement about getting a Windows 7 Phone this holiday season. I guess I will be happy with my Droid X. And start dusting off my Java development books as well.

 

Views: 3737

Tags:

Windows 7 Phone | Windows 7 Phone

How to use WCF in Windows 7 Phone Applications?

by Naveen 19. July 2010 05:27

When you are building a data driven Windows 7 Phone application, use a web service or WCF service comes as natural choice. If you have been using WCF for your Silverlight and ASP.Net or any other applications, you will find that use of WCF for Windows 7 Phone is similar to what you have been doing so far. It is easy to the extent that you can simply cut and paste the code from your existing Silverlight to Phone application and it will work like a charm. This holds true if you are not using any namespaces or APIs that are not supported in Windows 7 Phone SDK. Otherwise you are golden. In this post, I will show you how to use WCF in Windows 7 Phone applications.

I will be using project from my previous post Using Bing Map Silverlight Control. In that project, I used a WCF service to pull data from server and associated it with bing map silverlight control. I am going to develop the same application but for Windows 7 Phone. In this post I will just focus on using WCF in Windows 7 Phone.

Create Windows 7 Phone Project

I am assuming that you have installed all development tools needed for Windows 7 Phone application development. Create a new Windows 7 Phone project in Visual Studio 2010. Since I want to display list of users on main page of application, so I picked Windows Phone List Application project. This provides boiler plate code to quickly set up your pages to display list on main page and then a details page to display details when user clicks on an item in the list.

Add Service Reference

Yes, it is the same Add Service Reference menu items in your project that you have seen in Silverlight, ASP.Net or any other .Net application projects. You will follow the same procedure of adding reference to WCF service in Windows 7 Phone application.

Call WCF Service To Fetch Data

It is exactly the same asynchronous model that gets used in Silverlight application. Well that makes sense because Windows 7 Phone development uses Silverlight as well. I copied the code from Silverlight application and used it in Windows Phone application without any change and it worked. The following code snippet shows async call to WCF service to which I added reference to my project.


 public void GetUserConnectionData(int sinceLastId, int maxResults, 
    Action<IEnumerable<UserConnectionDataViewModel>, Exception> callBack)
 {
   _wsActivityMonitor.GetUserConnectionsCompleted += (s, e) =>
   {
    var userCallBack = e.UserState as 
    Action<IEnumerable<UserConnectionDataViewModel>, Exception>;
    if (null == userCallBack)
    {// Wrong data type.return;}
     // Check if we got an error from request.
     if (null != e.Error)
     {
       userCallBack(null, e.Error);
       return;
     }
     // Process results.
     var connectDataList = new List<UserConnectionDataViewModel>();

     foreach (var connectData in e.Result)
     {
       var ucViewModel = new UserConnectionDataViewModel(connectData);
       connectDataList.Add(ucViewModel);
     }

     userCallBack(connectDataList.AsEnumerable<UserConnectionDataViewModel>(), null);
    };

    _wsActivityMonitor.GetUserConnectionsAsync(sinceLastId, maxResults, callBack);
 }

If you will download code from my earlier post, you will find the code to be same. You can play with sample project to see how this all works and how Windows 7 Phone application is binding to data from WCF service.

 

Views: 8414

Tags: ,

WCF | Windows 7 Phone

Windows 7 Phone Development Tips - How To Set Page Orientation

by Naveen 16. July 2010 13:21

One of the cool things about smartphones is that you can flip the view of your applications between landscape and portraint just by rotating your phone or device. Well, just because the hardware has the capability to flip these views does not mean that every application will adjust its view accordingly. When you develop a Windows 7 Phone application, you have to set the option of view(s) you are going to support.

Here are some notes from Microsoft's documentation of Windows 7 Phone API.

Windows Phone supports orientation changes, both portrait and landscape. If necessary, applications must be configured to support multiple orientations, and by default are set to only portrait. If a specified page on the application supports both landscape and portrait orientation, the user can initiate a change by physically rotating the device. There is no programmatic way to directly switch the orientation as the orientation property is set to read-only. The only method to accomplish this is to set the SupportedOrientations property to the desired orientation.

Note: The orientation portrait down, or upside down, is not supported in Windows Phone. Applications that need to use this feature can use the device accelerometer to change the UI; however, the chrome will remain in the normal portrait mode.

The page has an Orientation property and a SupportedOrientations property. If the application navigates to a page where the SupportedOrientations property does not include the current orientation, it will initiate a device orientation change to the specified orientation.

How to set orientation of Windows 7 Phone Application

As the documentation says that you have to set SupportedOrientation on the page. Current beta release of tools do not seem to allow to set this property from designer. So you can set this from the code itself. Following code snippets show how you can set SupportedOrientations property of a page.


public DetailsPage()
{
 InitializeComponent();
 SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
}

 

Views: 2346

Tags: ,

Windows 7 Phone | Windows 7 Phone

Windows 7 Phone Development Tips - How To Twist Emulator View

by Naveen 15. July 2010 06:51

One of the cool things about latest smartphones is the ability to switch view of the application by twisting and turning your device. If you are using Windows 7 Phone emulator, you do not have that luxury. No, you do not have to twist and turn your laptop or desktop monitor to do it. Windows 7 Phone emulator has buttons to do it. When you move your mouse on edge of emulator window, a menu slides open on upper right hand corner. It has two buttons that can twist the view clockwise or counter clockwise. Following image shows those two buttons.

 

Views: 2837

Tags: ,

Windows 7 Phone | Windows 7 Phone

Windows 7 Phone Development Tips - How To Close Emulator Window

by Naveen 15. July 2010 06:36

Since Windows 7 Phone device is still not available widely so you probably are using emulator to test your application. After you have done your testing, now you want to close the emulator windows. And probably are looking for X button on top right corner of that emulator window. And you do not see it.

No, you are not stuck. The close button is there. It appears when you move your mouse on any of the edges of emulator window. A menu will slide open on upper right corner of the emulator window from where you can close it.

 

Views: 1578

Tags: , ,

Windows 7 Phone | Windows 7 Phone | Windows 7 Phone

Smart Phones Poll

What smart phone do you currently own?





Show Results

Month List

Powered by BlogEngine.NET 2.0.0.49
Theme by Naveen Kohli