Cyberiafreak

"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

February 17, 2005 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~

February 17, 2005 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 –>

February 16, 2005 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 ]

February 15, 2005 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

February 9, 2005 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.

February 7, 2005 Posted by | Uncategorized | Leave a comment

My code in office – for reference

‘// FOR SALESMEET REPORT
Private Sub clt_Click()
If scope2 = "" Then
MsgBox "Select scope of the report !! ", vbExclamation, " Sales port !!"
Else
If scope2 = "B" Then
If code = "" Then
MsgBox "Please select any branch….! ", vbInformation, "Salesport!!……….Select branch… "
Else
wb.Navigate salesurl & "sales_pcl_rep_index2.asp?st=1&ac=SM&scope=" & scope & code ‘ querystring
wb.Visible = True
End If
End If

End If
End Sub

————————-
case "R"
act="sales_wo_rep.aspx"
rs.Open "select *from WORECIEPT where " & condition & " and (datepart(month,WOR_REC_DT)=datepart(month,getdate()) or datepart(month,WOR_REC_DT)=datepart(month,dateadd(month,-1,getdate())))"
head="WORK ORDER RECEIPT- LISTING REGION LEVEL "
case "A"
act="sales_wo_rep.aspx"
rs.Open "select *from WORECIEPT where datepart(month,WOR_REC_DT)=datepart(month,getdate()) or datepart(month,WOR_REC_DT)=datepart(month,dateadd(month,-1,getdate()))"
head="WORK ORDER RECEIPT – LISTING INDIA LEVEL"

—– Today lot of updation in existing salesport application. Successfully cleared 3 errors.

3-2-2005 went to dumlur for BDOTNET Seminar [ topic was asp.net caching ]

February 5, 2005 Posted by | Computers and Internet | Leave a comment

Some important facts about -asp.net

Question:
Can I still run ASP pages on a server that runs ASP.Net?

Answer:
Yes. They will run side-by-side with no adverse affects to the ASP pages at all.

Question:
Does ASP.Net still recognize the global.asa file?

Answer:
ASP.Net does not recognize the standard ASP global.asa file. Instead it uses a file named global.asax with the same – plus additional – functionality.

Question:
Can ASP pages and ASP.Net pages share session variables.

Answer:
No. Both support session variables, but the session variables are not shared across the two platforms.

Question:
What is the process-flow for ASP.Net?

Answer:

1. User requests an ASPx page in their browser

2. An HTTP requests is sent to IIS

3. The xspisapi.dll isapi filter intercepts the request and passes the request on to the XSP worker process (xspwp.exe)

4. Xspwp takes care of handing the request to the appropriate HTTPModules and finally an HTTPHandler as defined in the configuration files.

5. The ASPX page is read from the HD or cache and server code is loaded into memory and executed.

6. The server side code outputs normal HTML which is handed back through the chain of modules and eventually to IIS, which sends the response back to the client’s browser.

7. If the user clicks or otherwise acts on an HTML element (say, a textbox) that has a server side event handler, the form is posted back to the server with hidden form fields containing information as to what control and event occurred.  Some controls do not automatically post by default, but wait for a button_click event to post.  This is configurable by the developer.

8. The ASPx page is again loaded into memory using the same sequence of events as before, but this time ASP.net reads in the hidden form field data and automagically triggers the appropriate _OnChange, OnClick and other appropriate event handlers.

9. Resulting HTML is sent to the browser

10. The process continues in a continual "Post Back" cycle.

Definition of HTTP Modules:
HTTP modules are a logical replacement for ISAPI filters.  Modules are a class that can participate in every web request.  This is appropriate for code that should run on every request, such as caching, authentication or state management

Definition of HTTP Handlers:
HTTP Handlers provide the end point in the processing of a web request and are equivalent to ISAPI Extensions today.  For example, many handlers can be involved in the request for an ASPX page, but only 1 handler is invoked.  The handler runs after the HTTP modules have run.  Which handler is invoked is determined by configuration settings in the config.web file.  Handlers are assigned to handle requests based on the extension of the page requested.

February 2, 2005 Posted by | Computers and Internet | Leave a comment

   

%d bloggers like this: