.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Check if page is opened from certain page

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :ASP.Net

Hello people,

I have a vacation booking page and don't want customers to go directly to the booking page. (course in that case customers could enter there own dates or leave the dates blank)
Is there a way that if a user enters www.mysite.com/booking.aspx into there browser it redirects to an error page.

But the page must be visible after filling in arrival and disparture dates on a parent page. 

So to simplify: Can I check on opening booking.aspx if the sender is calendar.aspx then open booking.aspx else goto error page


Cheers Danny

View Complete Post

More Related Resource Links

Check if a page is opened . IF opened, close the page.



I am generating a new report page by using the following code.

            ScriptManager.RegisterStartupScript(this, typeof(string), "openNewWindow", "window.open('../Report_Preview.aspx','ReportPreview','scrollbars=yes,resizable=yes,')", true);


 But, the above script is used in more than 20 parameter page which ultimately always open the same Report_preview.Aspx page.

What i want to check  while running the above script is "give a warning if the Report_preview.Aspx is already opened"


Any idea please!!!!!

Check Page Referer in Javascript?

Is there a way to execute a javascript function based on the page referer?So if the user comes from an internal page then doesnt execute but if it comes from an external page then it does?Thanks

Page does not close after Response.BinaryWrite when opened in IE 6 sp 3

Hi all, I currently having problems in closing a page opened using IE 6 sp 3 after Response.BinaryWrite. All other versions of IE it closes fine. This page was opened using window.open. Below is a sample code of what i am trying to achieve: protected void Page_Load(object sender, EventArgs e) {            Response.Clear();  //Specify the document type.  Response.ContentType = "application/word";  //Specify how the document is sent to the browser.  Response.AddHeader("content-disposition", "attachment; filename=MyDasddsaocument.doc");  //Get data bytes from the file and send it to the response.  byte[] bytes = System.IO.File.ReadAllBytes(@"C:\\Temp\\in.doc");  Response.BinaryWrite(bytes);  Response.End();  Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseMe", "window.close();", true); } I hope someone  can help me with this issue. Thank you in advance.

This Page has been modified since you opened it on Sharepoint 2010

When I use Server.Transfer("page2.aspx") the page2.aspx get's succesfully loaded. But when you you use Server.Transfer("page1.aspx") to get back from that page2.aspx to the page1.aspx. I got the following error: This Page has been modified since you opened it. You must open the page again... The above scenario is working perfectly on MOSS2007. Has anybody got an idea why this is not working on Sharepoint 2010 server? Thx Kris Kris Buntinx

Unable to Check In Publishing Page

I am running into an issue with a custom page layout that I have created.  On this page layout I have a publishing html field, publishing image field, and a publishing summary links field.  The problem is when I check-in the publishing page as a draft the content in the publishing HTML fields does NOT save and redirects me to the root page in that web. I then checked the SharePoint ULS logs and found the following error. Time: 09/03/2010 11:47:20:18 Process: w3wp.exe (0x1248) TID: 0x0C5C Area: CMS Category: Publishing Cache EventID: 98ee Level: High Description: Trying to store a checked out item (/EN-US/MEDICALPRODUCTS/PAGES/646.ASPX) in the object cache.  This may be because the checked out user is accessing the page, or it could be that the SharePoint system account has the item checked out.  To improve performance, you should set the portalsuperuseraccount property on the web application.  See the documentation for more information. I have tried to find more answers on the web but have been unsuccessful so far.  Has anybody seen this error before or got any possible ideas to try?  Thanks in advance for any help. Craig

SharePoint Couldn't redirect to another page after document check in


Hi all,

I want to redirect to other page after check in the document in the document library. So I coded in ItemCheckedIn event.

But the problem was raised:

  • When I click the Check In button, system would pop up the message "The file could not be checked in. It may already been checked in by another user." (But it would check in the document later).
  • It couldn't redirect to other page after checking in.

Can anyone help?Thx.


Check for session in master page before child page


I have a site which has restricted access.  Access is controlled via session variables.
There are a lot of pages to the site so I was going to check for the session variable via the page load event in my mater page.  However, on certain pages I use the session variable in that pages page load event.  This throws an error when the session doesn't exist, but what I want is the master page's page load to fire first.

Does anyone know how I could achieve this?

Javascript to identify whether a page is opened in a popup


Hey every one.


I have an AllItems.aspx page in my Sharepoint list. Requirement is to close the page in the page load if it is opened in a popup window.

If it is opened not in the popup window, then we don not want to close it.

I am looking for a javascript to do this. I want a javascript to be placed in the content editor web part (CEWP) present in my AllItems.aspx.

Any one knows how to do this ?

This Page has been modified since you opened it. You must open the page again.


I am getting the following error, any suggestions would be appreciated:


This Page has been modified since you opened it. You must open the page again.


My scenario is that I've deployed a custom ASP.Net 2.0 application to my SharePoint site using option 4 (ASPX pages added to SharePoint Site) from this post http://blogs.msdn.com/cjohnson/archive/2006/09/05/application-development-on-moss-2007-amp-wss-v3.aspx#742416


My application has a screen with a button on it.  When I click that button it should open up a new window with an aspx page.  The solution works when I run it through visual studio, but not in SharePoint.  All of the posts on this issue I have found have to do with Load Balancing (which we are not doing) and upgrading to WSS 3.0 (we started with 3.0).  The code below is a script function that is run when the button is clicked.  It doesn't seem to be a code problem, as I've been able to achieve this same functionality in a stripped down test application.


function DisplayReport()


Get Page Layout to check whether a field is filled in and display

I have a page layout that has a URL Field which users can fill in, if needed.  The field is:
<SharePointWebControls:UrlField FieldName="DetailedInformation" InputFieldLabel="Link to Plan Change page" runat="server"/>

This field lives in the Edit Mode Panel but I need to display it within the page, if the user fills it in.

The only way I know how to display fields throughout a text of the page, is to use the FieldValue, e.g.

<SharePointWebControls:FieldValue FieldName="DetailedInformation" runat="server"></SharePointWebControls:FieldValue>

Is there a way to say "if the above field is not null, then display with formatting as below" - similar to an If statement.

<p class="ms-rteCustom-hyperlink-arrow">
	<SharePointWebControls:FieldValue FieldName="DetailedInformation" runat="server"></SharePointWebControls:FieldValue>

If I put the above code and the field isn't filled in, the arrow (from the class) will display but I do not want it to.

Please note that I am using SharePoint Designer 2007 to create the page layout.

Auto-check in new variation page



I need to automatically check in pages that are created by variations (i.e. when a user clicks the "Create a variation of this page for a target label"-button, the created page should, in some cases, be checked in in the target label).

I've tried to hook up an event receiver (listening to ItemAdding, ItemAdded and ItemCheckedIn) to the pages library, but this doesnt get hit when Variations creates the page (only when I add a page manually to the library).

Any ideas why and/or how to do this?



This Page has been modified since you opened it. You must open the page again


Hi All,


I know there are quite a few posts in forum with same Title. I (actually, my client) am facing problem in little different condition.


User has added a new Web Part page and tries to customize it. When User clicks on Site Action à Edit Page and click on “Edit Title Bar Properties” link following message displays:

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

Reduce ASP.NET Page size and complexity using JQuery

This is my first post on asp.net blog. ASP.NET Ajax and JQuery are two different ajax framework. In this post I will show, how we can enhance gridview using ASP.NET Ajax and JQuery. I also compare the implementation of these frameworks. In next posts i will explain more about JQuery and ASP.NET Ajax and also tell you "How to combine the power of both framework". My Future post will related to ASP.NET and related frameworks.


I have 2 web pages. First page has a textbox and a button control.

when I enter test and click on the button , system goes to the second page. And in the second page I want to access the Textbox in the first page. When I try to do this I get the following error.

"Object reference not set to an instance of an object. Following is my code :

Dim txt As New TextBox

' Find the server name on the previous page
txt = CType(Page.PreviousPage.FindControl("TextBox2"), TextBox)
If Not IsNothing(txt) Then
Response.Write("[Name Not available]")
End If

I know I could do this with session, but I want to use the Page.PreviousPage.FindControl. Any help is greatly appreciated

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend