When I am trying to build my solution I am getting Could not create type Upload.ashx.I am pulling out my hair to solve this.Can anyone suggest me how to rectify this problem.And I don't know how to actually append the namespace to the class?
As I am having
Here is my code:
<%# WebHandler Language="vb" CodeBehind="Upload.ashx.vb" Class="Upload" %>
And this is my dir structure:
wwwroot/Test/Myproject
I don't think there is such a thing as an .ashx.vb file type.
Try changing your top line to:
<%# WebHandler Language="VB" Class="Upload" %>
and then just put your code behind code in the .ashx file
<%# WebHandler Language="VB" Class="Upload" %>
Imports System
Imports System.Web
Public Class Upload : Implements IHttpHandler
'Code here....
End Class
Alternatively, have you tried building your code?
See this similar question for more help:
Custom Http Handlers IIS7 and ASP.NET
I've been banging my head against the wall for a few hours over this error "could not create type", and it may not help your exact problem
I had split my codebehind across many partial classes, all called "restserver" apart from one which was called "restServer" (note the capital S) it was that small difference that was causing the error, I changed them all to the same case and it worked perfectly.
VS isn't very helpful when working with ASHX files.
I know this is an old question, but it is at the top of google at the moment, so for anyone looking: In a website project, the handler directive expects different parameters for websites and webapps. In this case (website) was looking for codeFile instead of (webapp) codeBehind:
<%# WebHandler Language="vb" CodeFile="Upload.ashx.vb" Class="Upload" %>
Add below tag
<%# Assembly Name="YourNameSpace.YourHandlerClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=90e3045b123af1c3" %>
above your WebHandler tag
<%# WebHandler Language="vb" CodeBehind="Upload.ashx.vb" Class="Upload" %>
Necromancing a thread but I just had the same issue. The suggestion for Assembly Name by #sagar-s didn't work for me. So I tried this and I got a good build (not sure yet about actual functionality) :
<%# Assembly Src="~/MyService.ashx.cs" %>
<%# WebHandler Language="C#" CodeBehind="MyService.ashx.cs" Class="Namespace.MyService" %>
The Src and Name attributes are mutually exclusive. The CodeBehind attribute and Src attribute are redundant. I haven't tried to see if Src will be adequate if CodeBehind is removed. No time to experiment at almost 3am here - or to read docs which may clarify such things. HTH
Related
I don't know what happened with my project, but since I reinstalled my pc with Windows 8, the website doesn't build...
My #Page directives look summing like this:
<%# Page Title="Register" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Register.aspx.vb" Inherits="_Register" %>
The codebehind for this page looks like this:
Partial Class _Register
Inherits MobilePage
' subs go here (don't think they're important for the question)
End Class
With this set up this way, I'm getting the following error:
Could not load type '_Register'.
Removing the Inherits attribute fixes this error, but what else does it do in terms of the page's functionality?
I have created a application page for login functionality in sharepoint by following this post.
But this giving me an error at inheriting the page. I have folder structure and .aspx file like below.
Did I done any mistake while giving the link to the .cs file in the application page?
After I deployed into my site, it is giving me error like below.
I am trying to resolve it from 2 hrs, but unable to find the solution. Can any one suggest me the way to do it please!!
Try to add
<%# Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
before
<%# Page ... %>
Add $SharePoint.Project.AssemblyFullName$ to your Inherits attribute
Instead of <%# Page Language="C#" AutoEventWireup="true" CodeBehind="YourPage.aspx.cs" Inherits="YourNamespace.YourPage" %>
Use <%# Page Language="C#" AutoEventWireup="true" CodeBehind="YourPage.aspx.cs" Inherits="YourNamespace.YourPage,$SharePoint.Project.AssemblyFullName$" %>
This could also be happened when there are another reference to that assembly which didn't exist. To show the error, simply check Ha Doan answer.
I'm the newly appointed tech-guy at a small company. I've inherited their near-complete ASP.NET web page that's been left "near-complete" for some time, but I'm not really familiar with ASP.NET. It was dropped by the original developers a few years ago, and a year or so back someone tried to finish it using only inline code.
Now that I've unearthed the old VB source files, I've made a one-line change to the Page.aspx.vb and need get it associated to it's Page.aspx file. Trouble is, the #Page directive directly inherits its own App_Web_Page.xxxxxx.dll. Every page does this. This is not reflected in the source I have to work with, but is the way it now operates. The last person to touch it has long since forgotten the details of his work, and I'm not familiar enough with ASP.NET to know what to ask.
So my #Page directive goes like so:
<%# page language="vb" autoeventwireup="false" inherits="Page,
App_Web_page.aspx.cdcab7d2" masterpagefile="~/Master.Master"
enablesessionstate="True" enableEventValidation="false" %>
When I try to precompile the site, my #Page directives look totally different:
<%# page language="vb" autoeventwireup="false" Codebehind="Page.aspx.vb"
inherits="Project.Page" masterpagefile="~/Master.Master"
enablesessionstate="True" enableEventValidation="false" %>
And, being precompiled, It doesn't yield a page-unique .dll file I can just swap into the live bin directory and change the #Page directive for. I've tried a number of permutations on the #Page directive to try to get it to compile the new VB code on access, but I always wind up with errors, the best of which tell me ASP elements in the .aspx aren't defined in the .aspx.vb.
Can someone point me in the right direction with this?
You have to select the option like below highlighted...
I am in the process of upgrading a website from Visual Studio 2005 to 2010. I ran it through the importer, however I'm having some errors. Specifically I'm having the following error:
Error 615 Unknown server tag 'CTL:PayPal'
If I go to the file that it is complaining about I have the following at the top of the file:
<%# Control Language="C#" AutoEventWireup="true" Inherits="PowerShop.Admin.UI.Customer.Controls.CustomerPaymentList" %>
<%# Register TagPrefix="CTL" TagName="OrderPaymentList" Src="~/Order/Controls/OrderPaymentList.ascx" %>
<%# Register TagPrefix="CTL" TagName="PayPal" Src="~/Order/Controls/OrderWizard/PayPalDetail.ascx" %>
<%# Register TagPrefix="CTL" TagName="Term" Src="~/Order/Controls/OrderWizard/LineOfCreditDetail.ascx" %>
<%# Register TagPrefix="Shipping" TagName="AddressVerification" Src="~/Controls/AddressVerificaton.ascx" %>
<%# Import Namespace="PowerShop.Configuration" %>
I have checked and double checked the register tags and the file but everythin appears to be correct. The file exists (PayPalDetail.ascx) in the exact location I am specifying. This page does not throw any errors on any of the other register tags. Any help or insight would be much appreciated.
I think it would be in wrong place like you could have by mistake put it in the page instead of putting it in the UserControl which have the Register tag.
Also, this can occur if the Paypal user control is not able to compile due to some bug in it.
Where are you placing the CTL:Paypal tag ??
.
PS: More detailed question could have a chance of more detailed answer !
I have own control implemented in "CommonControls" assembly (the same namespace). It us 'Custom control' inherited from 'WebControl' class and implemented without ascx file.
It is necessary to use this control in "main" web site. Could you please advise how to register this control?
I know it should be something like this:
<%# Register Assembly="CommonControls" Namespace="CommonControls"
TagPrefix="uc" TagName="TopMenuControl" Src="..." %>
But what should I specify in the "Src" property?
Thanks.
It seems like I've found solution myself:
<%# Register Assembly="CommonControls" Namespace="CommonControls" TagPrefix="uc" %>
<uc:TopMenuControl class="container" runat="server" />
Src and TagName are just not required :)
But anyway, any thoughts (if you see any better solution) are welcome .