Category Archives: ASP and ASP.net

Crystal Report issue in ASP.NET: Maximum report processing jobs limit configured has been reach…

Some Crystal Reports developed in the asp.net site stopped working, and turn on the debug, found the following error message:

System.Runtime.InteropServices.COMException (0x80041016): The maximum report processing jobs limit configured by your system administrator has been reached.

Anyone knows how to fix this issue? What I did to do a work-around was resetting the IIS and get the website back to normal. But I am afraid that this problem will come back if the Crystal Report asp.net class could not be Garage Clean correctly. Please let me know if you have a solution, thanks.

[Resolved] BC30560: ​’mycontrol_​ascx’ is ambiguous in the namespace ‘_ASP’

Just got back to the office and had to update a lot of asp.net web pages. Some of them share the same content, so I created a couple of User Control files (ascx) and shared them in some aspx files. They didn’t have any problem on my development machine, but repeatedly had the following compile error when I uploaded to the testing and production servers.

BC30560: ​’mycontrol_​ascx’ is ambiguous in the namespace ‘_ASP’

Tried some fixes but still had the same error, like

  1. Stop the WWW services, then delete all asp.net temporary folders and files under the directory of “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files”;
  2. Deleted the asp.net files, and re-uploaded again;
  3. Changed the debug to false in the section <compilation debug=”false”> in web.config file;

Finally, I found out that since I am using Visual Studio 2010 to create the new Web User Control for asp.net 2.0, the file automatically uses the classname in my ascx file.
<%@ Control Language="VB" ClassName="WebUserControl1" %>

 Then I updated the <%@ %> as the following, and it works. Finally!
<%@ Control Language="VB" AutoEventWireup="false"  %>

UserNameRequiredErrorMessage not showing in the Validation summary control when in content page of a master page

It works in a simple web form, but not in the content page of a master page.

For example, there is a simple content page:

<%@ Page Language="VB" MasterPageFile="~/Master1.master"
AutoEventWireup="false" CodeFile="Login.aspx.vb"
Inherits="Login" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

   <asp:Login ID="Login1" runat="server">
    </asp:Login>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server"
        ValidationGroup="Login1" />
</asp:Content>

But the validation summary is not appearing when a password is not entered. There is a blank space on the page for the validation summary, and the login control displays the red asterisk indicating an error. But the error never displays.

Solution:

To resolve this issue, I had to look at the HTML source code and realized that the Master Page changed the client ID of this Login control. And a simply way to resolve this is to put the asp:Content ContentPlaceHolderID before the Login Control ID as shown the below.

ValidationGroup=”ctl00$ContentPlaceHolder1$Login1″

Of course a better method would be to set the ValidationGroup programatically in the page init method:

ValidationSummary1.ValidationGroup = Login1.UniqueID;

Problems with ASPNETSQLProvider (user instance) in Web Projects in Visual Studio 2010 of Windows 7

I figured out the cause of my problem in the previous post: since the web site I tested in Visual Studio 2010 is under the folder of \Documents\Visual Studio 2010\Websites, and my OS is Windows 7. For some reasons, the Web Site Administration Tool could not auto generate an aspnetdb.mdf under my APP_DATA folder.

I searched the web, and tried the following steps I found from Microsoft web site (http://support.microsoft.com/?kbid=2002980).

Continue reading

AspNetSqlProvider does not work in ASP.NET web site administration tool

Recently playing around the Membership feature of ASP.NET, and trying to follow the sample article on MSDN(“Walkthrough: Creating a Web Site with Membership and User Login“). But I got error message when I launch the ASP.net Web Site Administration Tool, which occurred on the Security tab as the below:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.

So I went ahead to click the Provider tab, and then click the Test link of AspNetSqlProvider under the Provider section. But I got the following error message:

Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.

I understand that this error was caused by the database connection. First I had to make sure I have already installed the aspnetdb in my local MS SQL server. I closed the Web Site Administration Tool, and launched a DOS command prompt. Next I ran “aspnet_regsql” under the directory of “C:\Windows\Microsoft.net\Framework\v4.0.30309\” which launched a MS SQL connectionwizard. After I was done with that wizaard, I then verified in my MS SQL 2008 R2 server. I found there was a new database instance called “aspnetdb” created and have some tables like “dbo.aspnet_Applications”, “dbo.aspnet_Users” etc.

Continue reading

How to display random list items with Array Shuffle

Recently I need to develop a quiz application which will generate the questions and answers on the fly, and each time the answers will be in random order while the quiz is called. It is easy to just randomize the answer items list, but we still need to have the A, B, C, D in front of these answer items in alphabet order. And we still need to track which one is the correct answer. Here are what I came up so far.

First, use dataset to retrieve all answers based on the question ID from the Database; then fill in an array variable.

…. Other Codes ….

 Dim dtA As DataTable = DAL.GetDataTable(myCommand)
...
  'assign values to array list, assume there are only 4 (A, B, C, D) answer items in the multiple choice question
    Dim arrAnswers(3, 1) As String
    Dim iAnswer As Integer = 0
    Do While iAnswer < dtA.Rows.Count
    arrAnswers(iAnswer, 0) = dtA.Rows(iAnswer).Item("ANSWER_TITLE").ToString
    arrAnswers(iAnswer, 1) = dtA.Rows(iAnswer).Item("A_CORRECT").ToString
    iAnswer += 1
    Loop

Continue reading

Issues with creating Database Connections to Oracle in SharePoint Designer 2007 (Resolved)

Challenges:

I tried to connect to Oracle database in SharePoint (MOSS 2007). But got the following error when I tried to create a Database connections in Designer 2007.

1), Use custom connection string;
2), Select Microsoft .NET Framework Data Provider for Oracle as the Provider Name;
3) Post the below as the Connection String:

Password=<passwd>;User ID=<userID>; Data Source = <mydatasource>; Persist Security Info=True; Provider=OraOLEDB.Oracle;

4), It seemed the Oracle db can be connected, but could not find the root catalog since the "Initial Catalog=root;" was appended to the above connection string automatically.
5), and the error message is:

Server Error: An error occurred while retrieving the list of Tables from the root Database: The query you are trying to execute contains syntax errors.

I searched on the Internet, and was told there is a way to use BDC(Business Data Catalog). But I just need a simple way to show Oracle data on a SharePoint page. BDC connection is too much for me at this point.

Continue reading

How to generate valid Credit Card numbers and validate in asp.net

Disclaimer: The following information is intended for informational purposes only.

creditcardsJust read the hacker quarterly magazine 2600 while I am in the SQL training. And I found out the information on the Page 19 is very interesting. Within it, the author taught how to generate the valid credit card numbers to fool some free trial web sites since these web site will not verify the credit card is real, but only to check these numbers are valid.

I think it will be a good point for us, as developer, to use these formula to do some simple  credit card numbers validation as well in our code. Or just simply to generate some fake-real credit card to do the application testing.

Continue reading

Send Free Text Messages via SMTP in applications

I was thinking to update some of my ASP.net  applications which are sending alerts to subscribers via emails. The update will allow them to send out alerts as SMS (Short Message System) or text messages to users’ mobile phones.

I believe we need some third-party add-ons in the ASP.NET code to accomplish the above. But in North America, there is a work-around to do so since most of the cellular providers have a email-like system for their phone numbers.

Continue reading

Easy way to Format Strings with Capital Inital letters in VB.NET

I am developing a web application with ASP.NET and Oracle database. In the Oracle, there is a table with a “City” field whose data is in Upper Case. To make the data look good, I format the city name in the Stored Procedure with InitCap function from Oracle as the blow:

SELECT DISTINCT INITCAP(F_city) AS CITY FROM CITY_TAB
ORDER BY CITY ASC;

Now, I need to accomplish the same in my VB.NET code. Of course, based on my previous knowledge I was not aware of  such String Function in VB.net the similar as the INITCAP. And I used to write a function to loop all strings and put the first letter in Capital when we were coding in VB script (ASP).

This week, I found out a easy way to do so in ASP.NET. Now you can use StrConv to get the formatted string. For example:

Dim strCity as String = strConv(strCity, vbstrconv.vbproperCase)

Enjoy programming!

System.Data.OracleClient will be deprecated in .net framework 4.0

Got an email forwarded by the co-worker, saying the Microsoft ADO.NET team is going to deprecate OracleClient as a part of their ADO.NET roadmap.

The Decision

After carefully considering all the options and talking to our customers, partners, and MVPs it was decided to deprecate OracleClient as a part of our ADO.NET roadmap.

Recommendation and Guidance:

System.Data.OracleClient will be available in the upcoming 4.0 release of .NET Framework; however, it will be marked as deprecated. This will have no impact to existing applications and these applications will continue to work as expected. Developing new applications which use OracleClient will be supported; however, warnings will be raised if the applications are compiled against .Net 4.0. Once compiled, no warnings or errors will be generated while running these applications. We strongly recommend customers to use  our partners’ ADO.NET Provider for Oracle  instead of continuing to use Microsoft’s OracleClient for new application development.

Continue reading

Domain user name issue in web.config for Windows authentication

Today one of my co-workers did the trouble shooting and resolved this stupid problem together with me, and suggested put on the blog to share it. So here we go.

To make one of our internal web application authentication method simply, I decided to use Windows authentication and put the only one user in the web.config. The following are what I put in the web.config:

<authentication mode=”Windows”  />
<authorization>
<allow users=”DOMAINNAME/USERID”/>
<deny users=”*”/>
</authorization>

But the web form won’t authenticate me even I put the right user name and password, a windows logon prompt always jumped out.

I changed to <deny users=”?” /> then everyone can get in.

By the way, I have made the change in IIS to disable the anonymouse authentication and enable the Integrated Windows Authentication.

Finally, we figure out that we used the wrong slash in the user name. We should use backward slash “\” instead of the forward slash “/”. The working code should be

<authentication mode=”Windows”  />
<authorization>
<allow users=”DOMAINNAME\USERID”/>
<deny users=”*”/>
</authorization>

Gosh, never paid attentions on it before. I used both of them in asp.net 1.1.

two issues of asp.net development

Today, got bothered by two issues when I was doing the asp.net development.

First, all of the sudden, the “~” symbol in my code did not work anymore after I did some modifications. For example, I have one line of code to re-direct the users to an error page (/MyApp/App_Include/ErrorPage.aspx) like the below.

Response.Redirect("~/App_Include/ErrorPage.aspx?aspxerrorpath=" & Me.Page.Request.Url.ToString(), True)

But when any errors raised in some web forms in the location of /MyApp/Forms/somepage.aspx, I could not be re-directed to the ErrorPage.aspx, instead I got a 404 page not found error. It seemed the system was trying to find /MyApp/Forms/~/App_Include/ErrorPage.aspx.
Continue reading

Fix Access is denied (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) on local machines

ASP.NETSince Wednesday, all developers’ machines could not load asp.net applications on Visual Studio’s development servers. And we even could not debug, build the solution and could not Copy Website either; and could not drag/drop the AJAX Extension toolkit controls to the web forms.

The error message when we loaded the web application was the following:

Server Error in ‘/MyAPP’ Application.


Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

……

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

……

[FileLoadException: Could not load file or assembly ‘AjaxControlToolkit, Version=1.0.20229.20821, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e’ or one of its dependencies. Access is denied.]

Continue reading