• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 963
  • Last Modified:

Running simple asp.net app in sharepoint

"The codefile attribute on the page directive is not allowed in this page."

I coded a small asp.net app and created a virtual directory for it. I uploaded the default startup (aspx) page to
a documents library and created a link to it on the homepage. When I click the link to run the app, I get the above
error.

Can you help me with the step by step of what I should do?

Thanks,

Dave
0
drlewicki
Asked:
drlewicki
  • 5
  • 4
1 Solution
 
MelMcCommented:
Edit the web.config found here: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config
Here are examples to allow a site, page, and global to run code blocks

<PageParserPaths>
        <!-- To allow a single file: -->
        <PageParserPath VirtualPath="/test.aspx" CompilationMode="Always" AllowServerSideScript="true" />
        <!-- To allow global: -->
        <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" />
        <!-- To allow global within a subsite: -->
        <PageParserPath VirtualPath="/websitefoobar/*" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths>
0
 
drlewickiAuthor Commented:
I can still have my default startup page in a documents library and launch from a link on a homepage?

VirtualPath="/test.aspx    - /test.aspx is the full path of the application? What if it's in a virtual directory?
0
 
MelMcCommented:
shouldn't matter. I would just put the entire path as to where your page is in the virual path
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
drlewickiAuthor Commented:
       <!-- To allow global: -->
        <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" />
 Is that supposed to be VirtualPath = "/*" or do I substitute the name of the application in for it?
0
 
MelMcCommented:
That is if you want to allow code blocks on your ENTIRE site collection, not recommended
I would just put the virtual path to the page that you are trying to access.
0
 
drlewickiAuthor Commented:
I have this same application available to many sites. Do I have to adjust the web config for that?
0
 
MelMcCommented:
You have to add an etnry for every place that it is  stored in the virtual path, it doesn't matter where they click on it, but where the code is run from.
0
 
drlewickiAuthor Commented:
Clarifying...There is one virtual directory with the code. I want to link to that on many sites in sharepoint.
It seems to me to put the virtual directory address in the web.config location that you gave me.
Is this right??
0
 
drlewickiAuthor Commented:
I did this another way using a list.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now