Bridge the Zoomtown Westell Router

October 29, 2009 at 6:19 PMRampidByter

Assuming that the internet service provider (ISP) is in fact Zoomtown, and the subscriber trying to setup the bridge is using a Westell router provided by Zoomtown. I want it noted that you should only follow these steps if you have the hardware and knowledge needed to both secure and maintain the network setup.

Home Network DiagramThe ideal setup, in my opinion, is having the Westell router provided by Zoomtown going into another router that will be used as the central router used for the home in this case. The internal router should hopefully have intrusion protection, and at very least a firewall built in. If you’re questioning whether your particular network router has those capabilities you may want to skip the step related to disabling the Westell router’s firewall settings. See the diagram on the right for an overview of the network setup I described above.

To begin it’s best to have either the desktop near to or bring the Westell router to close proximity. A laptop is most likely the best solution in this case as you’ll be able to place the Westell router at it’s permanent location.

Step 1: Connect to the Zoomtown Westell router directly.

To do this you’ll need a cat5e network cable that you’ll plug directly into the Westell router’s network port, and the opposite end into either your desktop or preferably laptop. Please note ahead of time that you should have a working virus scanner running and a firewall package enabled on the computer used to connect to this router directly.

Step 2: Log into the Westell router directly.

IP Address: 192.168.200.1

In order to log into the Westell router open the internet browser of your choice. I prefer Internet Explorer, but FireFox works just as well. Enter the IP address listed above into the address bar of the browser and navigate to the internal Westell router configuration interface. If this does not work then identify the IP address the PC you’re using to connect to the Westell router is currently using. Enter the IP exactly as your PC shows except for the last three digits. Change the last three digits to simply 1. So if you have 192.168.500.233 then enter 192.168.500.1 into the browser’s address bar.

Step 3: Change the Administrative password.

People forget to change the administrative password all the time for internet accessible routers. In my neighborhood alone there are six unsecured wireless networks. Each one of them is easily accessible and has a very decent signal strength. Not say I’ve gone into them, but simply that this is often the most overlooked security vulnerability  problem.

Once logged into the Westell router you’ll be greeted with the friendly Westell logo and menu options displayed below:

menu

Mouse over the “Maintenance” option and click on the “Change Password” menu option. You’ll be prompted to enter both a name and password twice for validation. Enter in something you’ll remember like ‘Admin’ for the name and at least a decently hard password to crack using any standard dictionary attack. All in all it’s better than the no user name and password to enter into this setup right?

Step 4: Turn off the Westell firewall settings. (optional)

Keep in mind this step is optional. In my setup there is a Linksys business class router with built in firewall, IPS, and other assorted mechanisms to secure my network. At that level having two routers providing firewall protection is overkill for my needs and most likely is just an added network delay. I also want to just make sure I am in total control of what the firewall blocks and does not block via my own personal router.

To turn off the firewall simply mouse over the “Configuration” menu option and click on the “Firewall Configuration” menu option. From the firewall configuration settings simply click the “None” radio button option. This will disable the internal firewall for the Westell router. The default is most likely set to “Low”, but this step is optional and up to the end user to decide.

firewall

Step 5: Set the virtual connection to bridge mode.

In order to set the virtual connection to bridge simply mouse over the “Configuration” menu option and click on “VC Configuration" menu option. A list of virtual connections will be displayed with the current status, and ability to edit the connections by clicking on the “Edit” button located next to the connection.

Locate and identify the enabled virtual connection, should be the only enabled connection by default. This connection it needs to be set to bridge mode from the default routed bridge mode. To do this again locate the enabled connection, and click the “Edit” button from the same row.

virtualconnect1 

virtualconnect2 A pop-up configuration window will appear with the settings for the virtual connection. The only setting that needs to be changed on this window the drop down box next to “Mode” under Bridge Settings. Locate and click the drop-down menu for “Mode”, and select “Bridge” from the drop-down listing.

Click the “Set VC” button to save the changes and to close the configuration window.

 

Step 6: Turn off Private LAN.

The last step is to disable the private LAN functionality of the Westell router. The private LAN will provide to the internal router an internal IP address making direct forwarding a problem. To receive an external IP address mouse over the “Configuration” menu option, and click the “Private LAN Configuration” menu options.

From the “Private LAN Configuration” settings simply uncheck the “Private LAN DHCP Server Enable” also uncheck the “Private LAN Enable” settings. This will now allow the internal router to receive an external IP address instead of the private LAN IP provided from the Westell router.

Summary

There are many other ways to get the same sort of behavior. The Westell router could be used in combination with a switch as the primary router to divvy out DHCP IPs to connected PCs. The port forwarding and firewall option on the Westell are not bad at all so it should offer itself as a nice router out of the box.

For my purposes I already had a business class VPN router and would prefer to work with the Linksys configuration UI I've acclimated to over the years. So as far as the preference goes it’s in my opinion the best option available. From this point the internal router can be used to forward ports used for remote desktop on 3389, web servers on port 80, or any other general purpose port used externally.

Posted in: How-to

Tags:

ASP.Net 3.5 ListView Control – Using DataPager

March 2, 2009 at 5:30 PMRampidByter

I was working on a new project recently and unlike many of the older projects i’ve been working on this new project was built on the .Net 3.5 framework. Meaning now, should i choose, i could use LINQ, or any other number of ‘new’ features available to me. I decided to start with a few basic updates to the project the first of which was to add a ‘paging’ ability to a data listing that previously had a screen limitation of 22 items max per group otherwise the items would not display in the visible screen area.

So the first thing that I decided to do was check out the ASP.Net 3.5 ListView control. For the longest time to create any number of data lists I've used a conjunction of data-bound readers with template fields or DataGrid lists. Going in using the ListView i was sold on two points, the first is the ability to create both a layout template, and the ability to great a group item template. For added icing there was also the ability to assign a DataPager to the ListView right out of the box, what fun!

What I ideally wanted to create was a data listing that had a previous, next, first, and last buttons on both the top and bottom of the data list. Along with this i wanted to be able to display the current row position, and have the movement controls show/hide based on the current index without having to implement my own data paging logic. Trust me i’ve had to create my own paging logic way more times than i can count, and have plenty of ‘code snippets’ to paste into place to provide it. The major draw to ListView was the data pager, and template support.

After looking around for a way to create the pager style i was looking for i came back highly dissatisfied. All i found was the same out-of-box Microsoft snippets displayed on the umpteen number of blog sites with wordy diatribes that only sufficed to say the same verbiage found on the Microsoft site with a few ‘neat’ and ‘look at what i did’ comments. So needless to say i had to pretty much just default to the plug and play method to make out what i wanted.

So after a number of hours reading, prodding, and poking here is what I came up with:

<asp:ListView ID="lvCartUsers" ItemPlaceholderID="itemPlaceholder" runat="server" 
 OnPreRender="lvCartUsers_PreRender"> 
 <LayoutTemplate> 
 <div class="cartUserNavControls"> 
 <asp:DataPager runat="server" ID="dpProductTopPager" PagedControlID="lvCartUsers" 
 PageSize="5"> 
 <Fields> 
 <asp:TemplatePagerField OnPagerCommand="cartUsers_OnPagerCommand"> 
 <PagerTemplate> 
 <div class="navMoveFirst"> 
 <asp:ImageButton CommandName="First" ID="ibFirst" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && (((Container.StartRowIndex / Container.PageSize) + 1) > 1) %>' 
 ImageUrl='<%# GetFirstImagePath() %>' runat="server" /> 
 </div> 
 <div class="navMovePrevious"> 
 <asp:ImageButton CommandName="Previous" ID="ibPrevious" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && (((Container.StartRowIndex / Container.PageSize) + 1) > 1) %>' 
 ImageUrl='<%# GetPreviousImagePath() %>' runat="server" /> 
 </div> 
 <div class="navMoveLast"> 
 <asp:ImageButton CommandName="Last" ID="ibLast" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && ((Container.StartRowIndex + Container.PageSize) < Container.TotalRowCount) %>' 
 ImageUrl='<%# GetLastImagePath() %>' runat="server" /> 
 </div> 
 <div class="navMoveNext"> 
 <asp:ImageButton CommandName="Next" ID="ibNext" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && ((Container.StartRowIndex + Container.PageSize) < Container.TotalRowCount) %>' 
 ImageUrl='<%# GetNextImagePath() %>' runat="server" /> 
 </div> 
 <div class="navPagerCount"> 
 Displaying Records 
 <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.StartRowIndex %>" /> 
 - 
 <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.StartRowIndex+Container.PageSize %>" /> 
 ( of 
 <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.TotalRowCount%>" /> 
 records.) 
 </div> 
 </PagerTemplate> 
 </asp:TemplatePagerField> 
 </Fields> 
 </asp:DataPager> 
 </div> 
 <div id="cartGrid"> 
 <div id="cartListHeader"> 
 <div id="headerFistName"> 
 <asp:Literal ID="lblFirstHeader" runat="server" Text="First" /> 
 </div> 
 <div id="headerLastName"> 
 <asp:Literal ID="lblLastHeader" runat="server" Text="Last" /> 
 </div> 
 <div id="headerCartNumber"> 
 <asp:Literal ID="lblCartNumberHeader" runat="server" Text="Cart #" /> 
 </div> 
 <div id="headerCartStatus"> 
 <asp:Literal ID="lblCartStatusHeader" runat="server" Text="Status" /> 
 </div> 
 </div> 
 <div runat="server" id="itemPlaceHolder"> 
 </div> 
 </div> 
 <br style="clear: both;" /> 
 <div class="cartUserNavControls"> 
 <asp:DataPager runat="server" ID="dpProductBottomPager" PagedControlID="lvCartUsers" 
 PageSize="5"> 
 <Fields> 
 <asp:TemplatePagerField OnPagerCommand="cartUsers_OnPagerCommand"> 
 <PagerTemplate> 
 <div class="navMoveFirst"> 
 <asp:ImageButton CommandName="First" ID="ibFirst" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && (((Container.StartRowIndex / Container.PageSize) + 1) > 1) %>' 
 ImageUrl='<%# GetFirstImagePath() %>' runat="server" /> 
 </div> 
 <div class="navMovePrevious"> 
 <asp:ImageButton CommandName="Previous" ID="ibPrevious" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && (((Container.StartRowIndex / Container.PageSize) + 1) > 1) %>' 
 ImageUrl='<%# GetPreviousImagePath() %>' runat="server" /> 
 </div> 
 <div class="navMoveLast"> 
 <asp:ImageButton CommandName="Last" ID="ibLast" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && ((Container.StartRowIndex + Container.PageSize) < Container.TotalRowCount) %>' 
 ImageUrl='<%# GetLastImagePath() %>' runat="server" /> 
 </div> 
 <div class="navMoveNext"> 
 <asp:ImageButton CommandName="Next" ID="ibNext" Visible='<%# (Math.Ceiling(System.Convert.ToDouble(Container.TotalRowCount) / Container.PageSize) > 1) && ((Container.StartRowIndex + Container.PageSize) < Container.TotalRowCount) %>' 
 ImageUrl='<%# GetNextImagePath() %>' runat="server" /> 
 </div> 
 </PagerTemplate> 
 </asp:TemplatePagerField> 
 </Fields> 
 </asp:DataPager> 
 </div> 
 </LayoutTemplate> 
 <EmptyDataTemplate> 
 <asp:Label ID="lblNoItems" runat="server" /> 
 </EmptyDataTemplate> 
 <ItemTemplate> 
 <div class="cartListRow"> 
 <div class="rowFistName"> 
 <asp:Literal ID="lblFirstName" runat="server" Text='<%# Eval("FirstName") %>' /> 
 </div> 
 <div class="rowLastName"> 
 <asp:Literal ID="lblLastName" runat="server" Text='<%# Eval("LastName") %>' /> 
 </div> 
 <div class="rowCartNumber"> 
 <a class="cartListRowCartNumber" href='<%# Request.Path + "?CartId=" + Eval("CartId") %>'> 
 <%# Eval("CartId") %></a> 
 </div> 
 <div class="rowCartStatus"> 
 <asp:Literal ID="lblStatus" runat="server" Text='<%# Eval("Status") %>' /> 
 </div> 
 </div> 
 </ItemTemplate> 
 </asp:ListView> 

Code-behind:

public partial class CartUserList : System.Web.UI.UserControl 
 { 
 #region Properties 
 
 private int _pageSize = 5; 
 
 public int PageSize 
 { 
 get { return _pageSize; } 
 set { _pageSize = value; } 
 } 
 
 private DataSet CartDataSet 
 { 
 get 
 { 
 DataSet dsCarts = null; 
 
 if (ViewState["DataSet"] != null) 
 { 
 dsCarts = (DataSet)ViewState["DataSet"]; 
 } 
 
 return dsCarts; 
 } 
 set { ViewState["DataSet"] = value; } 
 } 
 
 #endregion // </Properties> 
 
 #region Events 
 
 protected void Page_Load(object sender, EventArgs e) 
 { 
 try 
 { 
 if (!IsPostBack) 
 { 
 <Call RebindCartList here> 
 } 
 } 
 catch (Exception ex) 
 { 
 } 
 } 
 
 protected void cartUsers_OnPagerCommand(object sender, DataPagerCommandEventArgs e) 
 { 
 try 
 { 
 int position = e.Item.Pager.StartRowIndex + e.Item.Pager.PageSize; 
 
 switch (e.CommandName) 
 { 
 case "First": 
 e.NewStartRowIndex = 0; 
 e.NewMaximumRows = e.Item.Pager.MaximumRows; 
 break; 
 case "Last": 
 e.NewStartRowIndex = (e.TotalRowCount - e.Item.Pager.PageSize); 
 e.NewMaximumRows = e.Item.Pager.MaximumRows; 
 break; 
 case "Next": 
 if (position <= e.TotalRowCount) 
 { 
 e.NewStartRowIndex = position; 
 e.NewMaximumRows = e.Item.Pager.MaximumRows; 
 } 
 break; 
 case "Previous": 
 e.NewStartRowIndex = e.Item.Pager.StartRowIndex - e.Item.Pager.PageSize; 
 e.NewMaximumRows = e.Item.Pager.MaximumRows; 
 break; 
 } 
 } 
 catch (Exception ex) 
 { 
 } 
 } 
 
 protected void lvCartUsers_PreRender(object sender, EventArgs e) 
 { 
 if (IsPostBack) 
 { 
 <Call RebindCartList here> 
 } 
 } 
 
 #endregion //</Events> 
 
 #region Functions 
 
 private void RebindCartList(int customerID, int userID) 
 { 
 try 
 { 
 DataTable tblCarts = null; 
 
 if (CartDataSet == null) 
 { 
 CartDataSet = <BLL get DataSet> 
 
 if (CartDataSet.Tables.Count > 0) 
 { 
 tblCarts = CartDataSet.Tables[0]; 
 } 
 } 
 
 lvCartUsers.DataSource = tblCarts; 
 lvCartUsers.DataBind(); 
 } 
 catch (Exception ex) 
 { 
 } 
 } 
 
 #endregion //</Functions> 

The first thing you’ll see is the LayoutTemplate. This is the core to the ListView control as the entire structure of the ‘list’ is formatted within this template area. If one was building a HTML table the beginning tag for <table> and end tag </table> would be contained within this template. Unlike many other controls there is no header template and footer template instead what represents the header and footer of the template is defined within the LayoutTemplate. However, the actual data being repeated, ie the body of the data, is defined in the ItemTemplate.

Since I wanted the DataPager to appear above and below the list of data I have to create the two new DataPager controls above and below my ItemTemplate area so that they again appear above and below the data being paged. In order to get the look that I was going for I also had to implement my own TemplatePagerFields with the PagerTemplate set to display my custom ASP.Net ImageButtons with the selected first, next, previous, and last images to display instead of text. This is another benefit to using the TemplatePagerFields is that instead of having to use the built in text or button movement controls I can create my own by simply providing my own ASP.Net ImageButton controls with a custom CommandName. By using a custom command name I can just handle the event for OnPagerCommand to set the pagers index position based on the control clicked by the user. The code-behind snippet will show the OnPagerCommand being used to page the data. The thing to note here, as I saw in many blogs about paging problems, is that after a paging action is performed the data has to be rebound. It seems like out of the box the control should hold a temporary cache/session data when paging, but it doesn’t. That’s why on my example i handle the OnPreRender of the ListView control to re-bind the data when IsPostBack.

Getting back to the ItemTemplate that is sandwiched between the two DataPager controls. Within the ItemTemplate the bound data can be formatted as this will be the template repeated for each row of data found within the DataSource used to bind with the ListView. Here is where using Eval() the fields can be formatted for display applying any HTML elements or ASP.Net controls within the ItemTemplate area.

So from our perspective the layout looks much like this:

<LayoutTemplate>
<DataPager />
<ItemTemplate>
</ItemTemplate>
<DataPager/>
</LayoutTemplate>

The best part is that by setting the PagedControlID of the DataPager controls to the ListView control I can simply add a few functions to check whether to display the paging controls based on the current PagerSize of the DataPager and I no longer need to handle calculating when to display the controls on the code-behind. You can see the functions for this on the Visible property of the DataPager’s PagerTemplate controls.

All in all not bad. The control is easy enough to use, but when searching for how to use the ListView i did come across many blogs where users couldn’t figure out why after a paging action occurred the ListView was empty. Easy enough, when it posts back the user still is responsible for rebinding the control with the data source. If a SqlDataSource control is used then a user can take advantage of the caching ability of the SqlDataSource otherwise on the post back the ListView must be re-bound with data. Keep that in mind and this is one sweet control.

There is one thing I've used but didn’t touch on and that's the GroupTemplate. The GroupTemplate sits within the LayoutTemplate where ItemTemplate would be displayed in my hierarchy above, but now the GroupTemplate itself contains a definition of the ItemTemplate within it. So what you’d get is the ability to span items, using <div> tags with float set, across columns, essentially creating a table arrangement across columns instead of just rows. Below is a rough hierarchy of how the GroupTemplate becomes involved. There is actually a great article here detailing how to use the ListView with a great snippet on setting up a GroupTemplate here http://msdn.microsoft.com/en-us/library/bb398790.aspx.

<LayoutTemplate>
<DataPager />
<GroupTemplate>
<ItemTemplate>
</ItemTemplate>
</GroupTemplate>
<DataPager/>
</LayoutTemplate>

For now I’ve just started using the control and I'm sure I'll find all kinds of nifty little tricks to perform this that and the other. Either way it goes I've found my new favorite control for quickly creating both grouped and lists of bound data in a way i can quickly put together using CSS to create quick lists of data that is both paging and dynamically syllable.

Posted in: ASP.Net | How-to | Programming

Tags:

Internet Explorer Kiosk Setting

January 17, 2009 at 9:56 AMRampidByter

While working on a touch screen kiosk i had to do a fair amount of work to figure out the best practices for designing, and building such a system. The biggest and most obvious component, dare i say secret, is that a touch screen Kiosk is nothing more than a standard web page. Yes, your typical web page being run on a machine whose only interface device is mouse clicks triggered by a touch to the screen. The system itself handles all the mappings between the mouse click and coordinates on the page the exact same way as a mouse interface device would. Simple right?

Not so simple when you try to take into account what browser you’ll be running your kiosk with. I’ve seen people write a custom desktop application whose sole purpose is to house an Internet Explorer browser object to create a full-screen browser without any file menu or title bar for the browser. These guys clearly didn’t do their research either because it’s pretty easy to create a full screen kiosk browser interface without the file menu along with disabling the touch screen users from interacting with the browser menus. No code required.

Using Internet Explorer launched with a simple command line parameter will cause the browser to open full screen, no menu options, and will not allow users to exit the browser without direct access to a keyboard. Since most touch screens use a virtual keyboard this doesn’t become a problem, otherwise what’s the point of a touch screen if you have to use a physical keyboard anyway?

Getting straight to it. All that is required to turn the standard Internet Explorer into a Kiosk interface is a the following command line argument for a shortcut to launch Internet Explorer.

"C:\Program Files\Internet Explorer\iexplore.exe" –k

Untitled

 

When Internet Explorer opens the browser it will be full-screen, display no file menus/status bar, and will not be able to be exited unless the key combo ALT-F4 or CTRL-W are used to close the browser. This secures the Kiosk environment from malicious users trying to close the browser to directly access the physical touch screen system. Pretty sweet huh? No code, no extra hassle, and now all you have to worry about now is securing your web interface from external non-kiosk activated attacks.

For those who prefer using Firefox, i won’t name names… or even myself, but there are a few add-ons built to provide kiosk functionality to the Firefox browser. Nothing, as I'm aware, built directly into the browser like Internet Explorer, but at least the ability is there at some level.

Posted in: How-to | Microsoft

Tags: