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
drlewickiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.