cyprich.com

Occasionally Relevant Insights from a Software Builder

By

Redirecting ASP.NET Pages

You can redirect an ASP.NET page using one of three methods. The first method is through metatag redirection. If that fails, then it will try to redirect with JavaScript. If that fails, a URL will be displayed that the user can click on to redirect the page.

An HTML 5 only version of this redirect page can be found in the post Redirecting Pages in HTML 5.

— ASP.NET code below —

<%@ Page Language=”C#” %>

<!DOCTYPE html>

<script runat=”server”>
</script>

<html>
<head runat=”server”>
<title>Page Title</title>

<meta http-equiv=”Refresh” content=”0; url=http://www.website.com”>

<!– If the meta tag doesn’t work, try JavaScript to redirect. –>

<script type=”text/javascript”>
window.location.href = “http://www.website.com”
</script>
</head>

<body>
<form id=”form1″ runat=”server”>
<div>
<!– If JavaScript doesn’t work, give a link to click on to redirect. –>

<p>If you are not redirected automatically, click <a href=’http://www.website.com’>here</a>.</p>
</div>
</form>
</body>
</html>

By

Finding the Version of Joomla in the Back End

I was trying to find out which version of Joomla was installed in a web site. The first place I looked was in the database where this type of information was normally stored. I couldn’t find any global settings table which would have the version number. This is because Joomla stores version information in the libraries folder in version.php which is located in different folders on Joomla 1.5 and Joomla 2.5/3.x.

Joomla 1.5
/libraries/joomla/version.php

Joomla 2.5/3.x
/libraries/cms/version/version.php

In the version.php document will be the following variables:

public $RELEASE = '3.3';
public $DEV_LEVEL = '1';

This shows that the installed version of Joomla is 3.3.1.

By

Restore Backed Up Database in MS SQL Server Using Transact-SQL

The following code will restore a database from a backup file in MS SQL Server. Normally you would use Management Studio to do this, but this might fail if the database needs to be in single user mode to restore. The code below will restore the database as a single user, then put it back in multi-user mode after its done.

—[ Transact-SQL Code ]——————–

-- Set database as single user and restore from backup.
USE master
ALTER DATABASE <your_database>
 SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE <your_database>
 FROM DISK = 'D:\Databases\YourDatabase.bak'
 WITH REPLACE
GO
-- Set database back to multi user.
ALTER DATABASE <your_database> SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO

By

Fixing Terms and Conditions in uStore 7.3

The “Terms and Conditions” link when creating a new user in uStore 7.3 do not seem to work on my system. When the link is clicked, it opens the login page in a new window. If an existing user logs in here, the terms page will then appear. The user will need to close this page and go to the previous page to login to a store.

I made s small modification to the Login.aspx page in \XMPie\uStore\App\CustomerApp folder.

<p>
<span style=”position: relative; top: -27px; left: 19px; padding-bottom: 2px; background-color: #F1F1F1;”>
I accept the <a href=”http://../Terms.html” style=”text-decoration: underline” target=”_blank”>Terms & Conditions</a>
</span>
</p>

The Terms file in the example above is in the CustomerApp folder. Place this code in the < tr id=”trAcceptTermsConditions” … > section. The code is placed after the existing terms and condition text and checkbox. If your not sure how to find it, search for “Please read and accept the Terms & Conditions”. Place the code addition after that.

My code doesn’t change anything on the login page. It creates a grey text box with the same text as the original terms and places the new text over the old one. You will only see the new text and the URL will open in a new page. Create a button to close the terms page or make a note on the bottom after they read it to close it.

By

Create a Custom Help File in uStore

You can define custom help or context sensitive help in uStore by creating an HTML file and entering it in the appropriate text box. This section is found when you login to uStoreAdmin and then do the following steps:

  1. Open the store.
  2. Go to Store Setting.
  3. Select Set Up Store.
  4. Go to the Advanced tab.
  5. In the Storefront Help Info section, you enter name of the help file(s) in Custom Help File or Context Senstive Help.

image
Click image to enlarge.

Its easy to create an HTML help file, but if you use the same file for multiple stores, its a good idea to make this file a redirect page which takes the user to the actual help file. The reason for this is that sometime down the road, you may decide to use a page with a different name, or in my case, the page could be hosted in a Joomla site where the name for a new help file that I create will be different.

If you only have one store, then it doesn’t matter what you name the file since its easy to replace, but if your hosting hundreds of stores it will not be a small task to replace all of the links with a new filename.

A simple solution is to make the help file an .ASPX redirect page. Each store will have the same file and if you create a new help file, the only thing you need to do is modify your .ASPX redirect file

The following page is an an .ASPX file which is saved in your XMPie installation at \XMPie\uStore\App\CustomerApp. Modify the red text to the actual URL of the help text.

—[ Help.aspx ]——————————–

<%@ Page Language=”C#” %>

<!DOCTYPE html>

<script runat=”server”>
</script>

<html>
  <head runat=”server”>
    <title>
uStore Help</title>

    <meta http-equiv=”Refresh” content=”0; url=http://mycms/ustore/help-12102013/>

    <!– If the meta tag doesn’t work, try JavaScript to redirect. –>
    <script type=”text/javascript”>
      window.location.href = “
http://mycms/ustore/help-12102013
    </script>
  </head>

  <body>
    <form id=”form1″ runat=”server”>
      <div>
        <!– If JavaScript doesn’t work, give a link to click on to redirect. –>
        <p>If you are not redirected automatically, click <a href=’
http://mycms/ustore/help-12102013‘>here</a>.</p>
      </div>
    </form>
  </body>
</html>