Twin Harbor Blog

Waypoint Website Design and Development

Connect to the Linksys RV082 VPN from mac OSX

clock May 14, 2008 07:30 by author Mike

I recently purchased a new iMac running OS X 10.5 for my home office. I'm running Parallels so I can develop code in Visual Studio.net and SQL, and graphic design work we're now doing in the Mac environment. I ran into an issue when I wanted to connect to my office router, a linksys RV082. In Windows you need the Linksys Quick VPN utility to connect to the VPN, but Linksys provides no such utility for the mac OS. Plus, the QuickVPN utility crashes when you try to run it on Windows Server 2003 running inside of parallels. Since I couldn't find any documentation online for how to connect to the VPN from a mac, and no forum posts I could find got it going for me, I had to do some trial and error testing. I finally got it working so I thought I would post the solution here for future reference. 

1. In the Router admin console, go to VPN >> PPTP Server

2. Create a user account and password and make sure that the PPTP server is enabled. Save Changes.

3. On your Mac, open the network preferences dialog. Click the + icon under the list of all your network connections on the left to add a new one.

4. Set Interface to VPN, then select PPTP from the VPN Type dropdown. Name your service and click Create.

5. Enter the server address (public IP of your router) and the account name you created. Encryption set to automatic worked for me.

6. Open Authentication settings and enter your password.

7. Click Apply, then connect.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Installation Order: SQL and Visual Studio

clock May 12, 2008 17:48 by author Mike

When building a new dev environment, there's an issue when you try to install Visual Studio followed by SQL Server because Visual Studio will install SQL Express if SQL server is not there. It causes some problems, so: 

The preferred order of installation is:

  • SQL Server 2005
  • VS 2005
Thanks to this page for details:
http://geekswithblogs.net/ingrid/archive/2006/02/03/68116.aspx  
 
 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Flash File Upload in Firefox with Session Management

clock April 23, 2008 07:15 by author Mike

To allow for multiple file uploads, we've found that the new Flash file upload component works very well. The flash (swf) gets placed on a page or control in your site, and allows you to select a list of files from your local machine to upload to the web server. When you click the Upload button, the flash component will post the files to a specified URL. In ASP.Net we create an ASHX (http handler) to handle the post, validate and save the files. Within the ASHX, we need to check the session to ensure that the current user is authenticated. To do this, your class must implement IRequiresSessionState:

public class Upload : IHttpHandler, System.Web.SessionState.IRequiresSessionState {  ...

Once you do this, sessions will be available. BUT!  Only in Internet Explorer! Turns out that Firefox, and probably many other browsers, don't carry over the cookie that stores the ASP.net session ID, and when you try to access the session from the handler, none of the values are there and context.Session.IsNewSession is true. After much searching, I was able to find a solution. 

The Solution
I should note that in our case we are using SqlServer session state, but I believe this applies to inProc as well. 

In your globa.asax.cs you can add the following:

protected void Application_BeginRequest(object sender, EventArgs e)
        {
            /* Fix for the Flash Player Cookie bug in Non-IE browsers.
            * Since Flash Player always sends the IE cookies even in FireFox
            * we have to bypass the cookies by sending the values as part of the POST or GET
            * and overwrite the cookies with the passed in values.
            *
            * The theory is that at this point (BeginRequest) the cookies have not been read by
            * the Session and Authentication logic and if we update the cookies here we'll get our
            * Session and Authentication restored correctly
            */

            try
            {
                string session_param_name = "ASPSESSID";
                string session_cookie_name = "ASP.NET_SESSIONID";

                if (HttpContext.Current.Request.Form[session_param_name] != null)
                {
                    UpdateCookie(session_cookie_name, HttpContext.Current.Request.Form[session_param_name]);
                }
                else if (HttpContext.Current.Request.QueryString[session_param_name] != null)
                {
                    UpdateCookie(session_cookie_name, HttpContext.Current.Request.QueryString[session_param_name]);
                }
            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                Response.Write("Error Initializing Session");
            }

            try
            {
                string auth_param_name = "AUTHID";
                string auth_cookie_name = FormsAuthentication.FormsCookieName;

                if (HttpContext.Current.Request.Form[auth_param_name] != null)
                {
                    UpdateCookie(auth_cookie_name, HttpContext.Current.Request.Form[auth_param_name]);
                }
                else if (HttpContext.Current.Request.QueryString[auth_param_name] != null)
                {
                    UpdateCookie(auth_cookie_name, HttpContext.Current.Request.QueryString[auth_param_name]);
                }

            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                Response.Write("Error Initializing Forms Authentication");
            }
        }
        void UpdateCookie(string cookie_name, string cookie_value)
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(cookie_name);
            if (cookie == null)
            {
                cookie = new HttpCookie(cookie_name);
                HttpContext.Current.Request.Cookies.Add(cookie);
            }
            cookie.Value = cookie_value;
            HttpContext.Current.Request.Cookies.Set(cookie);

        }

** found this code here: http://www.sitepoint.com/forums/showthread.php?t=541283

If you don't have a Global.asax in your application, you can add one to your project by selecting the 'Global Application Class' file template from the Add >> New Item menu.

The next step is to pass in the session ID on the querystring from the flash movie. We have a generic swf that we use throughout the Waypoint system which accepts the target URL for the upload as a parameter in the FlashVars. When you render your flash movie from an asp.net page or user control, you can do the following:

<param name="FlashVars" value='uploadPage=Upload.ashx%3fASPSESSID=<%=Page.Session.SessionID%>'/>

This will pass in the session ID as part of the querystring for the upload page. Then you can make your flash movie use the uploadPage parameter to target the upload. The session ID will be read in on the request and the session variables will be loaded.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


CSS Caching Issue in BlogEngine.net

clock April 21, 2008 16:37 by author Mike

We're using BlogEngine.net for this blog since it's open source and based on .NET 2.0. So far it works really well. One issue we ran into was that sometimes the stylesheet would not load and the blog would load without any styling applied at all. It happened very sparatically, so finding the issue has been tough. We've followed a post that told us to uncheck "Trim stylesheets" in the settings area. This seems to be working - we'll watch it and see if it resolves it permanently. 

The helpful post was here:

http://www.codeplex.com/blogengine/Thread/View.aspx?ThreadId=21864 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Web references and 'MSDiscoCodeGenerator' Error

clock April 18, 2008 07:16 by author Mike

I've been running into an error in Visual Studio .net 2005 when referencing the obelisk web services. 

The custom tool 'MSDiscoCodeGenerator' failed while processing the file '...Reference.map'.


There wasn't that much online about it. One of the better posts I found was here:

http://forums.asp.net/t/986668.aspx

But the solutions posted didn't fix my issue. One method that I tried and seemed to work was to create a new project in VS.net and reference the web service there. Then all the files that are created (.disco, .wsdl, reference.map, reference.cs) I copied over into my broken project. Then I went in and edited the namespaces and project names because they didn't line up. Once I did this I was able to get it to compile, and even hitting "Update Web Reference" works well now. I wish I could figure out what was causing this issue, but it seems to happen perpetually only in this one project, so something on the project level must be corrupted. At some point I will likely create a new project and import all my files to it so the project itself gets reconstructed, and hopefully the issues are cleared out at that point.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Development Blog

clock April 7, 2008 16:57 by author Mike
Welcome to the Waypoint Development Blog! We will be using this blog to post information about new features and upgrades that we're working on for the Waypoint website management platform. Subscribe to this RSS feed to stay up to date on all the latest additions to Waypoint!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Search

Categories


Calendar

<<  August 2008  >>
SuMoTuWeThFrSa
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

Archive

Tags

Blogroll

    Sign in