why Context.RewritePath method not work on iis - asp.net

I have an asp.net3.5 website.want to deploy this site on iis.After deploy my default page can not redirect to another page.Need help to understand why page not redirect
My default page is
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write("hello")
Context.RewritePath("~/asp/Default.aspx", False)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Need help why Context.RewritePath this method not working.my server version is windows server 2008 r2,iis-7.0 ,web site develop on 3.5
If have any query plz ask ,thanks in advanced.

This needs to be in your globals.acsx page, under begin_request

Related

User Control doesn't display in master page

I am working on a old ASP.NET project application.
I have to add a notification menu.
To achieve this, I have created a User Control which contains :
ComposantNotificationMenu.ascx
<%# Control Language="vb" AutoEventWireup="false" CodeBehind="ComposantNotificationMenu.ascx.vb" Inherits="extranet.Composant.ComposantNotificationMenu" %>
<ul class="ttw-notification-menu">
<li id="projects" class="notification-menu-item first-item">
Mes derniers évènements
</li>
</ul>
ComposantNotificationMenu.vb
Namespace Composant
Public Class ComposantNotificationMenu
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
End Namespace
Extranet_PageMaitre_Base.master
<%# Master Language="VB" CodeBehind="Extranet_PageMaitre_Base.master.vb" Inherits="extranet.Extranet_PageMaitre_Base" %>
<%# Register TagPrefix="GeneriqueComposant" Namespace="extranet.Composant" Assembly="extranet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Entete" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<asp:ContentPlaceHolder ID="cphEntete" runat="server" />
</head>
<body <%If Not Me.EstPageAccueil Then%>class="formulaires"<% end if%>>
<div id="divComposantMenuNotification">
<GeneriqueComposant:ComposantNotificationMenu ID="ComposantNotificationMenu" runat="server" Visible="true" />
test
</div>
<asp:ContentPlaceHolder ID="cphCorps" runat="server" />
</body>
</html>
The User Control Load event is handle but nothing is display on the screen.
I really have no idea.. I already develop other component but never in a master page. Is that the problem ?

Why is this clearly visible symbol unresolvable?

I'm getting an ASP Error, according to Resharper, "Solution MembersOrderEntry.sln
Project MembersOrderEntry
MembersOrderEntry\segovias-abq\Default.aspx:1 Cannot resolve symbol 'segovias-abq'"
In the same Default.aspx file, there is a similar error, "Solution MembersOrderEntry.sln
Project MembersOrderEntry
MembersOrderEntry\segovias-abq\Default.aspx:1 Cannot resolve symbol '_Default'"
Why are these symbols ('segovias-abq' and '_Default') unresolvable? The project contains many files named Default.aspx, with Default.aspx.vb beneath them; most of them throw no errors. But after letting Resharper "fix" funky namespace (where it thought they were wrong), I'm getting four of these errors.
Why are the lion's share of the Default.aspx files able to resolve their parent file, but this one is not? As you can see here, the relationship between the failing one and others are the same (a folder name, with Default.aspx beneath that, and Default.aspx.vb beneath that):
Seashore, SimonLeeman, Stern, Weyand, and many others all work fine.
The entire contents of the failing Default.aspx is:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="segovias-abq._Default" title="Web Order Entry" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Order Entry Login Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
...and the Default.aspx.vb for it is:
Partial Class _Default
Inherits Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Session("SelectedMenu") = "Home"
Response.Redirect("../Login.aspx?MemberNo=B1212")
End Sub
End Class
OTOH, the entire contents of one of the non-failing Default.aspx is:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Weyand._Default" title="Web Order Entry" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Order Entry Login Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
...and its Default.aspx.vb is:
Namespace Weyand
Partial Class _Default
Inherits Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Session("SelectedMenu") = "Home"
Response.Redirect("../Login.aspx?MemberNo=031")
End Sub
End Class
End NameSpace
IOW, except for the namespaces, they seem to be identical. But even when I added what would seem to be the one expected:
Namespace segovias-abq
...it changed nothing; I still get, "Cannot resolve symbol 'segovias-abq'"
ReSharper removes hyphens or underscores from namespaces when making the namespace names match their directory paths. During a refactoring, ReSharper will not look at string references unless you allow it.
I believe when you refactored, the hyphen was removed form the segovias-abq namespace but that namespace change does not appear to have been corrected in this portion of Default.aspx:
Inherits="segovias-abq._Default"

BC30451: 'NewsBody' is not declared. It may be inaccessible due to its protection level

Try as i might i cant get past this error. I'm not an ASP.Net developer but due to reasons outside my control have to develop 2-3 pages in ASP.
I'm using Dreamweaver and have the asp.net set to compile at first load.
.aspx File
<%# Page Language="vb" AutoEventWireup="false" Src="Scripts/CurrentNews.aspx.vb" Inherits="NewsFunctionality" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>News</title>
<link rel="stylesheet" type="text/css" href="CSS/NewsLayoutOne.css"/>
</head>
<body>
<div class="OuterDiv" runat="server">
<img id="NewsImage" src="Images/DefaultNews1.png" >
<div id="NewsBody" runat="server">Original Text</div>
</div>
</body>
</html>
.aspv.vb file
' VB Document
public partial Class NewsFunctionality
Inherits System.Web.UI.Page
'On load event for the page linked to this class file
protected sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
NewsBody.InnerHTML = "<p>Dynamic Text Generated.</p>"
End Sub
End Class
Check that 'NewsBody' have been declared within the designer.vb file.
It could look something like this since you are using a div:
protected global::System.Web.UI.HtmlControls.HtmlGenericControl NewsBody;

Opening a new window from a parent window in IE clears parent window's cache

I have a web app that opens a new window when a link is clicked. As soon as I do that though, my browser's cache is cleared. If I do not click the link, the cache is still there.
I have tried both the standard target="_blank" and window.open approach and they both result in the cleared cache.
Here is a reference to someone else encountering the same issue, but with no solution.
http://www.pcreview.co.uk/forums/problem-new-window-clears-cache-t693284.html
Any idea as to why?
IE 7 and 8
This is working for me, try out and let me know:
Html Page 1(Parent):
<%# Page Language="VB" AutoEventWireup="false" CodeFile="wpop1.aspx.vb" Inherits="pruebas_wpop1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PRIVATE" />
<title>Parent</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server"></asp:TextBox>
<a href="wpop3.aspx" target="_blank" >Popup</a><br/>
<asp:Button runat="server" Text="Button" />
</div>
</form>
</body>
</html>
Codebehind Page 1:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.ExpiresAbsolute = DateTime.Now.AddDays(2D)
Response.Expires = 7200
Response.CacheControl = "PRIVATE"
End Sub
Html Page 2(PopUp):
<%# Page Language="VB" AutoEventWireup="false" CodeFile="wpop3.aspx.vb" Inherits="pruebas_wpop3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>PopUp</title>
</head>
<body>
<form id="form1" runat="server">
<div>
This is the Popup Window.
</div>
</form>
</body>
</html>

Using the value from a login view control

I am trying to get the name (value) from a login view status contraol when a user in logged into my asp.net website. I want to put this value or login name into a textbox when the page loads.
Any help would be greatly appreciated.
Marlon Gowdie
Assuming the user has been authenticated then you can get the current user from the User property of the current Page. More than likely this is what the LoginView control is using internally to get the current user information.
here is simple example how to get the login name using login status control...
<%# Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Login1_LoggedIn(object sender, EventArgs e)
{
string name = Login1.UserName;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Login ID="Login1" runat="server" OnLoggedIn="Login1_LoggedIn">
</asp:Login>
</div>
</form>
</body>

Resources