//Cloud notes from my desk -Maheshk

"Fortunate are those who take the first steps.” ― Paulo Coelho

Please wait page page in – ASP.NET

Showing intermediate page [please wait page loading…] in Asp.net

*Mainpage.aspx——–> **Middle_page.aspx———> Finalrequestedpage.aspx
[no] [yes] [no]

* in submit button of page Mainpage.aspx
Response.Redirect("b.aspx?Page=c.aspx?")

** in body load event of html page Middle

————-
**

Advertisements

2005-02-17 Posted by | Uncategorized | Leave a comment

Including Javascript in ASP.NET

Hmm, this is pretty simple and tricky one. yes, using this regclientscript and regstartupscript we can include our Javascript.

HEre is the simple code i want for my appln, I mean i want to set focus the cursor to first text box as soon as my page got loaded.
Its like GOOGLE, when we load the google’s page, the pointer will defualtly points the text box for query.

———————————————–
Private Sub SetFocus(ByVal controlToFocus As Control)
Dim scriptFunction As New StringBuilder
Dim scriptClientId As String
scriptClientId = controlToFocus.ClientID
scriptFunction.Append("")
RegisterStartupScript("focus", scriptFunction.ToString())
End Sub
———————————-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Page.IsPostBack = False) Then
SetFocus(TextBox1)
End If
End Sub
———————————
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SetFocus(TextBox1)
End Sub
————————————-

Mahe~

2005-02-17 Posted by | Uncategorized | Leave a comment

web.config – Settings

Today for my salesport application[in lauchin phase], while we into testing for the past days, i have tried a lot for showing errors with approximate one. These are the web.config setting i have tried.

3 modes to display error:::::::::::::::::::::::::::

CustomErrors = Off [disable custom error and display app.error]
CustomErrors= On [ display custom page]
CustomErrors=RemoteOnly[ display the custom page in the remote but actual in the production server]

Here is the simple example for web.config structure…

Web.Config Configuration File –>

2005-02-16 Posted by | Computers and Internet | Leave a comment

SQL Query – office ref

Here is my office query which i have written for SALESPORT appln.

————————————————

select * from PCL where ((status=91) or (call_updated=111 and status <>91 and status <>92))

select due_by_activity,due_date,clt_name from activity_due a,pcl p where a.c_id=p.clt_id and datepart(week,a.due_date)=datepart(week,dateadd(week,-2,getdate()))and a.e_id=’SMS00102′

select due_by_activity,due_date,clt_name from activity_due a,pcl p where a.c_id=p.clt_id and datepart(month,a.due_date)=datepart(MONTH,dateadd(month,-1,getdate())) and a.e_id=’SMS00102′

——————————————————

SALESPORT APPLication is in testing stage and expecting for clients installation in Kolkata or ranchi hopefully.

Mahe!!!
[ a very next day of valentine ]

2005-02-15 Posted by | Computers and Internet | Leave a comment

VB.NET and ASP.NET Error handling…..(from site)

Here is the code which i want for Error handling in Vb.NEt and ASP.NEt . pretty simple for starters.

Sub DoSomething()
       Try
              ‘Do Something
       Catch SQLExp as SQLException
              ‘Catch the error and display it.
              Response.Write ("An SQL Server Error Occurred: " & e.toString())
       Catch IOExp as IOException
              ‘Catch the error and display it.
              Response.Write ("An File IO Error Occurred: " & e.toString())       
       Catch e as Exception
              ‘Catch the error and display it.
              Response.Write ("An Error Occurred: " & e.toString())
       Finally
              ‘Do the final cleanup such as closing the Database connection
       End Try
End Sub

—————————————-

ASP.NET hides all your application information (Your code), when your site is accessed from out side world. It only shows the application specific error message if you access the site locally. When you are developing the ASP.NET application, you may sit in a different machine than the one hosted the ASP.NET. In these cases you may want to see the error messages outside of the local machine also. Well, if you want to show the error messages outside the local machine then you can set the set the <customerrors> tags mode attribute to “off” in WEB.CONFIG. 

<configuration>
       <customerrors mode=”off” />
</configuration>

Custom Error page

The default message showed by ASP.NET may make sense in the development environment and it many not make any sense to the end users of the site. In that case, ASP.NET allows us to configure a default error-handling page for your site. We can specify the error page like this in WEB.CONFIG.

<configuration>
       <customerrors mode=”on” defaultredirect=”error.aspx” />
</configuration>

So, when an un-handled error occurs in ASP.NET application “Error.ASPX” error page will be displayed. After we’ve changed the configuration in the WEB.CONFIG, here is how the above error pages looks like.

 

Of course, we can make this page prettier some meaningful content to the end user of your site. 

The mode attribute in the <customerrors> tag can have two options. The difference is shown in the following table. 

Mode attribute

Localhost

IP Address

remoteonly

The error message from the compiler and the code that is causing the error will be showed.

Custom error page will be showed.

on

Custom error page will be showed.

Custom error page will be showed.

Final Note

ASP.NET and VB.NET both are providing excellent error handling options when compared with ASP and VB6.

Until next time, Happy Programming!

src:http://www.c-sharpcorner.com/vbnet/vbarticles/VBASPExHSSK.asp

2005-02-09 Posted by | Uncategorized | Leave a comment

Application and Session (most confusious one)mastered…..

Application and Session exposes events in a special file called "global.aspx". In classic asp, one had two events, viz , OnStart and OnEnd, for both the application and session. In the newer version, the application exposes more events providing for greater control. We shall look at application events in the global.asax file.

Application_AuthenticateRequest
This occurs whever a client accesses a resource that needs authentication.

Application_AuthorizeRequest
This occurs whever a client accesses a resource that needs authorization.

Application_BeginRequest
This occurs whenever a client makes a request any page in the application. One can make use of this event to redirect or check the validity of the requested page.

Application_End
This occurs when the application is stopped. This event is used to "clean" up variables and generally memory. This works exactly as in classic asp.

Application_EndRequest
This occurs when a client has completed request for a page.

Application_Error
This event is used to handle all unhandled errors in the application.

Application_PreSendRequestContent
This occurs just before ASP.Net sends the content to the client. One can use this event to push in content to the client.

Application_PreSendRequestHeaders
This occurs just before ASP.Net send the HTTP headers to the client. The header information can be modified using this event.

Application_Start
This event is exactly the same as the start event in classic asp. One can use this event to initialize variables and generally set up the environment. This occurs exactly once during the lifetime of the application, during the start of the application.

Application_Dispose
This event occurs when the application has completed all requests.

Application_Init
This event occurs before the start event and can be used to initialize the application.

2005-02-07 Posted by | Uncategorized | Leave a comment

%d bloggers like this: