Programming and web development are passions of mine, and I hope to have something useful to contribute to the community either through my work or through this blog.
Jul 15, 2009
Failed to access IIS metabase.
Problem
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Solution :-
This Error Caused Because You Not Have Register ASP.Net with IIS.Please Follow Following Step to Regiser ASP.Net With IIS.
-> Go to Start - > Run -> Cmd.
-> GO to Your System Drive Mostly C Drive.
-> Type C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i
Just wait And Message comes Successfully Register.
Unable to start debugging on the web server.
Following Error Comes When web Server is not configured correctly
"Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information."
Do the Following Step To resolve This Error
Step 1 : Open IIS ( Internet Information Service )
To Open IIS start >> Run Window >> Writr "inetmgr" Click Ok
Step 2 : Select your Application Directory Or Virtual Directory
Step 3 : Right Click On Application Directory Click On Create Button ( on Directory Tab )
Step 4 : Go On Asp.net Tab and Select correct Asp.net version .
Step 5 : Finally CLick On Apply .
Error solution
Failed to access IIS metabase.
This Problems occurs When you have both Microsoft Dot Net 2003 And 2005 in Your Pc .
In This Case You have to Install IIS After insalling .NET framework .
Do this Following Steps To resolve "Failed to access IIS metabase " issue
Step 1. repair .net
Step 2.Run This Command From Run Command Window ( Start >> Run ):-
"c:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i "
Finally Check ASP.NET version is associated with the virtual directory .
For That Do Following :-
- Right Click virtual directory name
- Select Properties
- Then ASP.NET tab
- Select ASP.Net Version
Hope So , This Will Help U ..
Jul 10, 2009
Regular Expression Important
The Regex class contains several static methods that allow you to use a regular expression without explicitly creating a Regex object. Using a static method is equivalent to constructing a Regex object, using it once and then destroying it.
Sample Code 1
Imports System.Text.RegularExpressions
' import the namespace
'instantiate the objects
dim oRegex as new regex("test pattern")
'use the object
If oRegex.IsMatch("this is the string to test on") Then
msgbox "Match found"
else
msgbox "Did not find match"
end i
Sample Code 2
//Check for correct format of your name
Dim myMatch As Match = System.Text.RegularExpressions.Regex.Match(InsertYourName, "^[A-Z][a-zA-Z]*$")
If Not myMatch.Success Then
'Name was incorrect
ErrorMessage("Invalid Name", "Message")
txtFname.Focus()
Return
End If
Regular Expressions Elements:
* . Character except a newline character(\n)
* \d Any decimal digit
* \D Any nondigit
* \s Any white-space character
* \S Any Non-white-space charater
* \w Any word character
* \W Any nonword character
* ^ Beginning of string or line
* \A Beginning of string
* $ End of string or line
* \z End of string
* | Matches one of the expressions seprated by the vertical bar; example eee|ttt will match one of eee or ttt (tracing left to right)
* [abc] Match with one of the characters; example [rghy] will match r, g,h or c not any other character.
* [^abc] Match with any of character except in list; example [ghj] will match all character except g,h or k.
* [a-z] Match any character within specified range; example [a - c] will match a, b or c.
* ( ) Subexpression treated as a single element by regular expression elements described in this table.
* ? Match one or zero occurrences of the previous character or subexpression; example a?b will match a or ab not aab.
* * Match zero or more occurences of the previous character or subexpression; example a*b will match b, ab, aab and so on.
* + Match one or more occurences of the previous character or subexpression; example a+b will match ab, aab and so on but not b.
* {n} Match exactly n occurrences of the preceding character;example a{2} will match only aa.
* {n,} Match minimum n occurrences of the preceding character;example a{2,} will match only aa,aaa and so on.
* {n,m} Match minimum n and maximum n occurrences of the preceding character;example a{2, 4} will match aa, aaa, aaaa but not aaaaa.
Jul 7, 2009
Sending Mail Using GMAIL in your Application
' Sending Mail to Multiple Recipient
Dim mails As Net.Mail.MailMessage = New Net.Mail.MailMessage()
Try
mails.To.Add(txtemail.Text)
mails.From() = New MailAddress("Your mail id here")
mails.Subject() = txtsubject.Text
mails.IsBodyHtml = True
mails.Body = texteditor.Content
'Attaching the File
Dim attachFile As New Attachment(Server.MapPath("Attachfile.doc"))
mails.Attachments.Add(attachFile)
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("yourmailidhere@gmail.com", "password")
SMTPServer.EnableSsl = True
SMTPServer.Send(mails)
Catch ex As Exception
End Try
End Sub
Jul 4, 2009
Easily refresh an UpdatePanel, using JavaScript
I’ve noticed a lot of discussion lately regarding methods to refresh an UpdatePanel via client script. This is very easy on the server side, of course. You can just call UpdatePanel.Update(). However, on the client side, the most common solutions I’ve been seeing just don’t feel right.
Many will advise you to use a hidden button control inside the UpdatePanel, manipulated via button.click(), to trigger a partial postback of the UpdatePanel. While it does work, I never have been able to get past the kludgey nature of that solution.
Finding a better way
To find a better solution, we’ll need a demonstration UpdatePanel to experiment with:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div id="Container">
<asp:UpdatePanel runat="server" ID="UpdatePanel1"
OnLoad="UpdatePanel1_Load">
<ContentTemplate>
<asp:Label runat="server" ID="Label1" />
ContentTemplate>
asp:UpdatePanel>
protected void UpdatePanel1_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
That’s a slightly modified version of the standard UpdatePanel DateTime example. Instead of the more commonly used Button_Click trigger, notice that the UpdatePanel’s OnLoad event is handled in code-behind.
Anytime UpdatePanel1 is loaded or reloaded in a postback, Label1 will be updated to reflect the current date and time.
Never fear, __doPostBack() is here
Luckily, there’s an easy method for triggering a postback targeted at the UpdatePanel: __doPostBack().
As long as the event target of a __doPostBack() call is an async trigger of an UpdatePanel, the ASP.NET AJAX framework will intercept the postback and fire a partial postback instead. For purposes of demonstration, I’m going to add that to the OnClick event of the container div:
<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
Now, clicking anywhere in the UpdatePanel will trigger a partial postback, targeting the UpdatePanel. Since partial postbacks follow the full page lifecycle, this will fire UpdatePanel1_Load and update the Label’s text.
A word on _doPostBack
You may have noticed that there is also an ASP.NET AJAX specific method of the PageRequestManager named _doPostBack. While it works much like __doPostBack, as long as the ASP.NET AJAX client framework is present, you should not call it directly.
The original __doPostBack method performs identically, but is more robust since it gracefully degrades to full postbacks when the ASP.NET AJAX framework isn’t available. It’s also unlikely that __doPostBack will disappear in future versions of ASP.NET, while it’s less assured that the ASP.NET AJAX framework will remain unchanged.
Did you know… Visual Studio has several different search options?
Did you know… Visual Studio has several different search options?
The standard methods for searching can be found under the Edit --> Find and Replace menu.
The “Quick Find” method (Ctrl+F) allows users to search inside of the current document, all open documents, the current project, the entire solution, and the current block by changing the Look in selection.
If you set Look in to be the current project or the entire solution, Visual studio will open files that have matches as you navigate between matches.
You can also adjust the settings under Find options to make the searches more specific by having them match on case or whole words or control how it searches by deciding whether it should search up or down or if it should look at hidden text (collapsed regions).
The Find in Files method (Ctrl+Shift+F) allows users to see all the occurrences of the search in one place, changes the Look in options by removing the current block, but allows users to search custom locations by using the “…” button next to the Look in drop down, and allows the user to restrict the types of files searched.
If you use Ctrl+F or select the Quick Find option from the find and replace menu by mistake, hitting Ctrl+Shift+F or selecting the drop down in the upper left corner of the dialog and selecting Find In Files will quickly get you to the Find in Files dialog.
Using the Result options section you choose to have the results displayed in either the “Find Results 1” or “Find results 2” window. Allowing you to switch between results if needed.
The Find What field also keeps a history of searches. To access this history click the down arrow of the Find What field. You can avoid using the history or typing search terms by having the value you want to search for selected in the editor before opening one of the find dialogs.
Did you know… You can now do Multiple Selection of controls in your Designer with VS 2008 SP1?
Did you know… You can now do Multiple Selection of controls in your Designer with VS 2008 SP1?
Visual Web developer 2008 SP1 supports multiple selection of controls on your designer using Ctrl+Click.
You can see that the designer:
- Displays the primary selected control with a white tab. Button3 in the image below.
- Enable you to set property for the selected controls using Property Grid. Note that the property grid would show you only the properties that are in common for all the selected controls.
- Enables you to make use of the Align, Make Same Size and Order Menu commands in your Format Menu options.
However VWD 2008 SP1 does not support the ability to drag drop multiple controls and Cut/Copy/Paste of multiple elements.
Thanks!
Windows 7 Release Candidate Announcement
Windows 7 Release Candidate Announcement
Microsoft is ready to release its next version of window named windows 7.
From April 30 ,2009 the RC is available to MSDN subscribers and TechNet Plus subscribers.
From May 5 (PST),2009 , the RC will be available to everyone via our Customer Preview Program. As with the Beta, the Windows 7 RC Customer Preview Program is a broad public program that offers the RC free to anyone who wants to download it. It will be available at least through June 30, 2009, with no limits on the number of downloads or product keys available.
With "Faster & easier" product tag line windows 7 is equipped with lot of new stuff that the user is bound to like. please visit "what's new in windows-7" at windows 7 portal.
for more information see latest Microsoft press release on
ASP.NET File Upload like GMail
ASP.NET File Upload like GMail
Ajax Uploader is an easy to use, hi-performance File Upload Control which allows you to upload files to web server without refreshing the page.
It allows you select and upload multiple files and cancel running uploads, add new files during uploading.
Ajax Uploader allows you to upload large files to a server with the low server memory consumption. The look and feel of file upload controls can be customized to seamlessly blend into your website design.
http://ajaxuploader.com/