Q: Can a C# project be combined with a VB.Net project in VS 2005?
A: You can compile each project separately then combine them together into a single assembly file using the assembly linker (AL.exe). This is a Microsoft utility that installs in the .Net framework folder (C:\Windows\Microsoft.NET\Framework\v1.1.4322).
Another option is to compile one project into a DLL or EXE then reference it from the other project.
Wednesday, October 12, 2005
Saturday, October 8, 2005
MSN Virtual Earth (using ATLAS)
For those who attended PDC 2005, there was a discussion of ATLAS and how powerful of a tool it is. To further demonstrate its capabilities, Microsoft created virtualearth.msn.com, a very cool map site. To further explain how the site was put together, check out http://weblogs.asp.net/scottgu/archive/2005/09/14/425131.aspx. The ATLAS add-on toolkit will be available for Visual Studio.Net 2005 sometime in 2006.
Wednesday, October 5, 2005
Career Eye for the IT Guy (or Gal)
The Greater Cleveland PC Users' Group will be hosting a roundtable meeting about IT careers in Cleveland, featuring local industry leaders and developers. Some of the topics discussed include the future of IT in Cleveland, the value of certification, and many more.
Last year over 100 people attended our discussion about the state of IT careers in Northeast Ohio. This year the GCPCUG is pulling out all the stops. On Saturday, October 8th, we’re having four roundtable discussions to talk about what technologies and skills are in the greatest demand. And what you can do to get those skills.
As always, our meetings are free and open to the public. For more info, visit http://www.gcpcug.org/genmeeting.php
Last year over 100 people attended our discussion about the state of IT careers in Northeast Ohio. This year the GCPCUG is pulling out all the stops. On Saturday, October 8th, we’re having four roundtable discussions to talk about what technologies and skills are in the greatest demand. And what you can do to get those skills.
As always, our meetings are free and open to the public. For more info, visit http://www.gcpcug.org/genmeeting.php
Saturday, September 24, 2005
Is there a benign virus I can use to test the AV scanner?
Q: Is there a benign virus I can use to test the AV scanner?
A: Eicar.org offers a benignvirus used for testing purposes. Although they don't offer support for any specific Anti-virus scanning tool, they can provide a simple virus that would help test your AV application. For more information and to download the virus, visit http://www.eicar.org/anti_virus_test_file.htm.
Thanks to Andrew H. for providing an answer to this question.
A: Eicar.org offers a benignvirus used for testing purposes. Although they don't offer support for any specific Anti-virus scanning tool, they can provide a simple virus that would help test your AV application. For more information and to download the virus, visit http://www.eicar.org/anti_virus_test_file.htm.
Thanks to Andrew H. for providing an answer to this question.
Thursday, September 22, 2005
How to search multiple columns, in 1 or more tables, for a single string?
Q: How can I search all varchar columns in a given table for a specific string, without building the where clause for every field?
A: select * from table1 where val1 + val2 like '%xyz%'
/* where val1 and val2 are varchar columns */
Also, if you have full text indexes defined on the columns of a table you can use the contains clause to examine each column that is indexed. If all of the varchar columns in mytable are are included in the fulltext index, then following will return any row that has the string abc :
select * from mytable where contains(*, '"*abc*" )
Thanks to Pete F. for helping with this question.
A: select * from table1 where val1 + val2 like '%xyz%'
/* where val1 and val2 are varchar columns */
Also, if you have full text indexes defined on the columns of a table you can use the contains clause to examine each column that is indexed. If all of the varchar columns in mytable are are included in the fulltext index, then following will return any row that has the string abc :
select * from mytable where contains(*, '"*abc*" )
Thanks to Pete F. for helping with this question.
IE Tab browsing
For those who enjoy using FireFox because of its ability to browse within tabs, IE is now offering a similar solution. With the help of the MSN toolbar, IE6 is now capable of tab browsing. To download the MSN toolbar, go to http://toolbar.msn.com/. This is toolbar is a production release, and is free of charge. In addition, several other tools are available on the same page (i.e. Windows Desktop Search, Internet Search tools, etc).
IE Developer Toolbar
In keeping up with FireFox and it's development toolbar, Microsoft released a similar developer toolbar for Internet Explorer. For more information and to download the toolbar, go to http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en
Please note that this IE toolbar is still a Beta!
Please note that this IE toolbar is still a Beta!
Tuesday, September 20, 2005
Why is "Save" grayed out on MS-Word 2003?
Q: I'm able to open a document in MS-Word 2003, but not able to make changes or save it. Why is "Save" grayed out on MS-Word 2003?
A: After some digging, it appeared that a virus had infected the user's system and de-activated Office 2003. After retrieving the registration number and re-activating MS-Office, everything should work fine as expected.
A: After some digging, it appeared that a virus had infected the user's system and de-activated Office 2003. After retrieving the registration number and re-activating MS-Office, everything should work fine as expected.
Invalid path for child request
Q: I call another web page from the application and pass it an argument (see sample below), but I receive the error "Invalid path for child request".
Dim strPath As String = "Error.aspx?Msg=" & strMsg
Server.Transfer(strPath, True)
A: Since the argument passed is not URL encoded, it causes the path of the web page being called to be incorrect. To correct the problem simply URL encode the argument being passed to the new page.
Dim strPath As String = "Error.aspx?Msg=" & Server.UrlEncode(strMsg)
Server.Transfer(strPath, True)
Dim strPath As String = "Error.aspx?Msg=" & strMsg
Server.Transfer(strPath, True)
A: Since the argument passed is not URL encoded, it causes the path of the web page being called to be incorrect. To correct the problem simply URL encode the argument being passed to the new page.
Dim strPath As String = "Error.aspx?Msg=" & Server.UrlEncode(strMsg)
Server.Transfer(strPath, True)
How do you throw an exception?
Q: How do you throw an exception?
A: The Throw() method is used to induce an error into the error handling routine. To generate an error, simply declare an object of type "Exception" with the desired message. Then call the Throw() method to send this error message to the error handling routine ("Catch" block). Once Throw() is called, all intermediate code will be skipped and execution will transfer to the "Catch" block, where Ex.Message="Something wrong happened!" See the code example listed below:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
'Some code logic here...
Dim ex As New Exception("Something wrong happened!")
Throw ex
'Some code logic here...
Catch ex As Exception 'Catch a generic exception.
Dim strMsg As String
strMsg = "Error: " & Ex.Message & ControlChars.CrLf
strMsg &= "Stack Trace: " & Ex.StackTrace & ControlChars.CrLf
lblError.Text = strMsg
End Try
End Sub
A: The Throw() method is used to induce an error into the error handling routine. To generate an error, simply declare an object of type "Exception" with the desired message. Then call the Throw() method to send this error message to the error handling routine ("Catch" block). Once Throw() is called, all intermediate code will be skipped and execution will transfer to the "Catch" block, where Ex.Message="Something wrong happened!" See the code example listed below:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
'Some code logic here...
Dim ex As New Exception("Something wrong happened!")
Throw ex
'Some code logic here...
Catch ex As Exception 'Catch a generic exception.
Dim strMsg As String
strMsg = "Error: " & Ex.Message & ControlChars.CrLf
strMsg &= "Stack Trace: " & Ex.StackTrace & ControlChars.CrLf
lblError.Text = strMsg
End Try
End Sub
Friday, September 16, 2005
How do you force a user to always login to web app?
Q: How do you force a user to always login?
A: In the Login.aspx page, the following code would be placed in the btnLogin_Click():
If wsAuth.Auth(strUID, strPWD) = True Then
'Successful Login
FormsAuthentication.SetAuthCookie(txtUserID.Text, False)
Response.Redirect("MainMenu.aspx")
Else
'Failure
ErrorLabel.Text = "Authentication did not succeed. Check user name and password."
End If
In each subsequent web page, check for authentication before loading the page. The following code would be placed in the Page_load event handler:
If Not IsPostBack Then
If Not (Request.IsAuthenticated) Then
Session.Abandon()
Response.Redirect("Login.aspx")
End If
End If
Forcing a Login and redirecting to the user's requested URL.
Q: If a user opens a browser and enters a URL to a specific page within a web application without loggin in first, how do you force him to login then redirect him to the page requested?
A: If you use the statement Response.Redirect("default.aspx?URL=" + HttpUtility.UrlEncode(Request.RawUrl)) in each page's Page_Load(), it will force users to the login page. In addition since you're passing the RawURL (the URL initially entered by the user), you can later redirect the user back to this URL only AFTER the user has logged in. This would be accomplished using the following code in the Page_Load() of each page of the application subsequent to logging in.
If Not IsPostBack Then
If Not (Request.IsAuthenticated) Then
Session.Abandon()
Response.Redirect("Login.aspx?URL=" + HttpUtility.UrlEncode(Request.RawUrl))
End If
End If
In Login.aspx, after the user has successfully logged in, we can redirect him back to the URL the user originally requested by accessing the URL passed as a parameter to the Login page.
For example, add the following code to the :
If wsAuth.Auth(strUID, strPWD) = True Then
'Successful Login
FormsAuthentication.SetAuthCookie(txtUserID.Text, False)
Response.Redirect(Request.QueryString(URL))
Else
'Failure
ErrorLabel.Text = "Authentication did not succeed. Check user name and password."
End If
A: In the Login.aspx page, the following code would be placed in the btnLogin_Click():
If wsAuth.Auth(strUID, strPWD) = True Then
'Successful Login
FormsAuthentication.SetAuthCookie(txtUserID.Text, False)
Response.Redirect("MainMenu.aspx")
Else
'Failure
ErrorLabel.Text = "Authentication did not succeed. Check user name and password."
End If
In each subsequent web page, check for authentication before loading the page. The following code would be placed in the Page_load event handler:
If Not IsPostBack Then
If Not (Request.IsAuthenticated) Then
Session.Abandon()
Response.Redirect("Login.aspx")
End If
End If
Forcing a Login and redirecting to the user's requested URL.
Q: If a user opens a browser and enters a URL to a specific page within a web application without loggin in first, how do you force him to login then redirect him to the page requested?
A: If you use the statement Response.Redirect("default.aspx?URL=" + HttpUtility.UrlEncode(Request.RawUrl)) in each page's Page_Load(), it will force users to the login page. In addition since you're passing the RawURL (the URL initially entered by the user), you can later redirect the user back to this URL only AFTER the user has logged in. This would be accomplished using the following code in the Page_Load() of each page of the application subsequent to logging in.
If Not IsPostBack Then
If Not (Request.IsAuthenticated) Then
Session.Abandon()
Response.Redirect("Login.aspx?URL=" + HttpUtility.UrlEncode(Request.RawUrl))
End If
End If
In Login.aspx, after the user has successfully logged in, we can redirect him back to the URL the user originally requested by accessing the URL passed as a parameter to the Login page.
For example, add the following code to the :
If wsAuth.Auth(strUID, strPWD) = True Then
'Successful Login
FormsAuthentication.SetAuthCookie(txtUserID.Text, False)
Response.Redirect(Request.QueryString(URL))
Else
'Failure
ErrorLabel.Text = "Authentication did not succeed. Check user name and password."
End If
Monday, September 12, 2005
.Net Events
Listed below are several .Net events to note on your calendar:
1. SharePoint SIG: September 12, 2005 @ 6:30 PM. For more info see http://gcpcug.org/sigdetail.php?pick_sig=44
2. C#/VB.NET SIG: September 27, 2005 @ 6:30 PM. For more info see http://www.clevelanddotnet.info
3. MSDN Event: October 04, 2005 @ 1:00 PM, Regal Severance Town Center. For more info, see http://www.msdnevents.com
4. SQL Server 2005, Visual Studio 2005 & BizTalk Server 2006 Launch, Tuesday, November 08, 2005 @ 9:00 AM in Detroit, MI. For
more info, see http://msdn.microsoft.com/launch2005
1. SharePoint SIG: September 12, 2005 @ 6:30 PM. For more info see http://gcpcug.org/sigdetail.php?pick_sig=44
2. C#/VB.NET SIG: September 27, 2005 @ 6:30 PM. For more info see http://www.clevelanddotnet.info
3. MSDN Event: October 04, 2005 @ 1:00 PM, Regal Severance Town Center. For more info, see http://www.msdnevents.com
4. SQL Server 2005, Visual Studio 2005 & BizTalk Server 2006 Launch, Tuesday, November 08, 2005 @ 9:00 AM in Detroit, MI. For
more info, see http://msdn.microsoft.com/launch2005
Friday, September 9, 2005
SQL Server & .Net Encryption
Q: I would like to encrypt credit card numbers and ssn numbers in the SQL database. The data will be submitted to the database from a .NET application and will be retrieved from a .NET application. Is there anything within .NET that can encrypt and decrypt the fields?
A: There is a System.Security.Cryptography class within .Net that supports various forms of encryption. Also, SQL Server 2000 has a built-in Encrypt() function that can be used. In addition, you should consider encrypting the data crossing the wire from the browser to the server, that's where many security attacks occur.
A: There is a System.Security.Cryptography class within .Net that supports various forms of encryption. Also, SQL Server 2000 has a built-in Encrypt() function that can be used. In addition, you should consider encrypting the data crossing the wire from the browser to the server, that's where many security attacks occur.
Subscribe to:
Posts (Atom)