asp.net web application deployment on another server iis - c#

I want to Deploy my ASP.Net Web Application on another Server IIS.
I already deploy it on Server but when I run that application that gives an error:
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'PhurtiCRM.AutoScript'.
Source Error:
Line 1: <%# Page Language="C#" AutoEventWireup="true" CodeBehind="AutoScript.aspx.cs" Inherits="PhurtiCRM.AutoScript" %>
Line 2:
Line 3: <!DOCTYPE html>
My C# Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AutoScript.BO;
using AutoScript.BLL;
namespace PhurtiCRM
{
public partial class AutoScript : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}

Related

Identifier expected in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PageProcessingDemo
{
public partial class : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
i haven't done anything yet ,but it still showing " Identifier expected ",and pointing to ":" when double clicked.
You haven't specified class name.
Change your code to something like this:
public partial class MyPageClass : System.Web.UI.Page
P.S: Also, you have said that:
i haven't done anything yet
I am pretty sure that somebody has removed name of the class.
Additional details:
Try to add new WebForm to the project. Set the name of form to WebForm1.After clicking OK, VisualStudio will create three or two files depending on the type of the project:
WebForm1.aspx
WebForm1.aspx.cs
WebForm1.aspx.designer.cs (WebApplication project)
The *.aspx files are the markup and the *.aspx.cs files are the code-behind files. Code-behind files handle the .NET code for any server-side controls in the *.aspx files. And Asp.Net will generate your code behind files as partial classes like that:
public partial class WebForm1 : System.Web.UI.Page

"Using" statement in asp.net fails

I'm a PHP developer learning ASP.NET, and it seems one has to twist an arm just to do something simple like connect to a database.
When I do the following.
<%# Page Language="C#"%>
<%
using System.Data.SqlClient;
using MySql.Data.MySqlClient;
//Connect to database
SqlConnection connection = new SqlConnection("Server=MYSQL5003.Smarterasp.net;Database=yyy;Uid=zzz;Pwd=xxx;");
//Determine the action we're performing
switch(Request.QueryString["action"]){
case "unsubscribe":
Response.Write(Request.QueryString["email"]);
break;
case "export":
Response.Write(Request.QueryString["action"]);
break;
default:
//Default action
break;
}
%>
I get a syntax error for some reason.
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1003: Syntax error, '(' expected
Source Error:
Compilation Error
Line 1: <%# Page Language="C#"%>
Line 2: <%
Line 3: using System.Data.SqlClient;
Line 4: using MySql.Data.MySqlClient;
Line 5: //Connect to database
Am I not supposed place the "using" statements in another file?
You have to use #Import when bringing in a namespace inline on an aspx page.
<%# Import Namespace="System.Data.SqlClient" %>

webservice shows parser error [duplicate]

This question already has answers here:
Parser Error Message: Could not create type 'xxx'
(3 answers)
Closed 8 years ago.
i am new to .net and i have to create a webservice for connecting with android.i got a simple example code and i put it in a mew webservice application and run it in debug mode.but it shows the following error in firefox.pls help to correct it.
Service1.asmx.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
namespace HelloAndroid
{
[WebService(Namespace = "http://sample.com/")]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string SayHello()
{
return "Hello, Android from .NET";
}
}
}
error
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'WebService1.Service1'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="WebService1.Service1" %>
Source File: /Service1.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.6387; ASP.NET Version:2.0.50727.6387
You've probably changed the namespace from WebService1 to HelloAndroid in Service1.asmx.cs. You need to update Service1.asmx file as well.

C# Inheritance Issues

Again, I'm fairly new at this sort of thing and perhaps the error message is telling me what it is and I'm simply not understanding, but... This code in anon.cs
namespace cheese.pies.org
{
using System;
using System.IO;
using System.Net;
using System.Web;
using System.Xml;
public class CasLogin : System.Web.UI.Page
{
private const string CasHost = "notimportant";
public static string GetId()
{
}
}
Ends up giving me an error when referenced here:
<% #Page Language="C#" Inherits="CasLogin" CodeFile="CasLogin.cs" %>
<script language="C#" runat="server">
protected void Page_Load(object sender, EventArgs e) {
String directoryId = CasLogin.GetId();
FormsAuthentication.RedirectFromLoginPage(directoryId, false);
}
</script>
The error is on line one and is:
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
If I change it from
public class CasLogin : System.Web.UI.Page
to
public class CasLogin : Page
I get this error:
Compiler Error Message: CS0246: The type or namespace name 'Page' could not be found (are you missing a using directive or an assembly reference?)
If I change it from public class CasLogin : System.Web.UI.Page to
public class CasLogin : Page I get this error
You are missing the correct using statement for the Page class (System.Web.UI) thus when you remove the full qualification the compiler can no longer find the Page class.
You should also fully-qualify the class name in the Page directive, i.e. Inherits="cheese.pies.org.CasLogin"
Good
<% #Page Language="C#" Inherits="cheese.pies.org.CasLogin" CodeFile="CasLogin.cs" %>
Bad
<% #Page Language="C#" Inherits="CasLogin" CodeFile="CasLogin.cs" %>
Per your comment regarding a missing partial modifier:
public class CasLogin : System.Web.UI.Page
Should be:
public partial class CasLogin : System.Web.UI.Page
This tells the compiler that the CasLogin class is defined in multiple files (which is the case with web forms; the designer file is separate from the code behind file).
If it still doesn't work, I suggest recreating the page and copying any relevant code into it. Normally Visual Studio handles all of this automatically and this is a non-issue.
I'm pretty sure it should be
<% #Page Language="C#" Inherits="cheese.pies.org.CasLogin" CodeFile="CasLogin.cs" %>
For the other error you can use
using System.Web.UI;
public class CasLogin : Page
Without fully qualifying the class name it doesn't know which Page you're talking about, so you can be explicit when you declare the class or you can use a using statement. The first error is the same issue, it can't see the CasLogin class inside the chees.pies.org namespace
inherits needs to be:
Inherits="cheese.pies.org.CasLogin"
Looking at my own little test project/code, I see a few things noticably different: the "usings" come before the namespace declaration, and the use of partial class for code behind. Also, note that the Inherits has the fully qualified class (includes namespace).
in Default.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
in Default.aspx.cs
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using System.Data;
namespace WebApplication2
{
public partial class _Default : System.Web.UI.Page
{

ASP.NET C# - Source File Parse Error - Could not load inherits type file

How do I fix this error?
I'm running .NET Framework v4.0.30319 so the Framework shouldn't be an issue. I'm not using any DLL files or bin directories. How do I setup the IIS/Virtual Directory if I'm using Forms Authentication for the whole website using VS2010?
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type
'ACAWebApplication.Pages.State_Carrier_Search'.
Source Error:
Line 1: <%# Page Title="ACA Web App - State Carrier Search" Language="C#"
MasterPageFile="~/Pages/User.Master" AutoEventWireup="true"
CodeBehind="State_Carrier_Search.aspx.cs"
Inherits="ACAWebApplication.Pages.State_Carrier_Search" %>
Line 2: <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent"
runat="server">
Line 3: <style type="text/css">
Source File: /Pages/State_Carrier_Search.aspx Line: 1
The Codebehind for State_Carrier_Search.aspx.cs file:
namespace ACAWebApplication.Pages
{
public partial class State_Carrier_Search : System.Web.UI.Page
{
protected void Page_LoadS(object sender, EventArgs e)
The code for State_Carrier_Search.aspx file is as follows:
<%# Page Title="ACA Web App - State Carrier Search" Language="C#" MasterPageFile="~/Pages/User.Master" AutoEventWireup="true" CodeBehind="State_Carrier_Search.aspx.cs" Inherits="ACAWebApplication.Pages.State_Carrier_Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
thanks!
Thou shalt not name class and namespace the same
THIS is Your problem
namespace ACAWebApplication.Pages
{
public partial class ACAWebApplication.Pages.State_Carrier_Search : System.Web.UI.Page
{
The parser sees an ACAWebApplication.PAges namespace and sees ACAWebApplication.Pages class name. This is probably legal but it is very wrong
Drop the ACAWebApplication.PAges from the class name and it should work. Was it autogenerated or You have extracted the namespace from the class name. Either way change it
and read
Eric lippert musings on it - whole series quite enlightening
Is the .NET version correctly set in IIS? This could be a .NET 2.0 app trying to run on the 1.0 framework.
Please refer to the Specify a .NET Framework Version for an Application Pool (IIS 7) article to learn more how to specify a .NET Framework version for an application pool.

Categories

Resources