Showing posts with label write. Show all posts
Showing posts with label write. Show all posts

Saturday, March 31, 2012

Server Side Debugging error in Hello World Application

Hi,

I'm new to the ASP.NET /.NET programming so excuse my very basic question. I
was trying to write the Hello World Application using ASP.Net using C# in
Visual Studio.Net
When I debug the application I get the error....

"Error while trying to run project. Unable to start debugging on the web
server. Server side-error occurred on sending debug HTTP request"

I have checked the usual Web.config for all the flags and also made my
Windows Domain User ID member of Debugger group etc.

Could someone please help and tell where I should look into to solve this
problem. This is very frustrating for me

regards
Bikram SuriThis might be of help... http://support.microsoft.com/?id=303067

"Bikram Suri" <bsuri@.hotmail.com> wrote in message
news:e0W91w4sFHA.2348@.tk2msftngp13.phx.gbl...
> Hi,
> I'm new to the ASP.NET /.NET programming so excuse my very basic question.
> I
> was trying to write the Hello World Application using ASP.Net using C# in
> Visual Studio.Net
> When I debug the application I get the error....
> "Error while trying to run project. Unable to start debugging on the web
> server. Server side-error occurred on sending debug HTTP request"
> I have checked the usual Web.config for all the flags and also made my
> Windows Domain User ID member of Debugger group etc.
> Could someone please help and tell where I should look into to solve this
> problem. This is very frustrating for me
> regards
> Bikram Suri

Server Side Debugging error in Hello World Application

Hi,
I'm new to the ASP.NET /.NET programming so excuse my very basic question. I
was trying to write the Hello World Application using ASP.Net using C# in
Visual Studio.Net
When I debug the application I get the error....
"Error while trying to run project. Unable to start debugging on the web
server. Server side-error occurred on sending debug HTTP request"
I have checked the usual Web.config for all the flags and also made my
Windows Domain User ID member of Debugger group etc.
Could someone please help and tell where I should look into to solve this
problem. This is very frustrating for me
regards
Bikram SuriThis might be of help... http://support.microsoft.com/?id=303067
"Bikram Suri" <bsuri@.hotmail.com> wrote in message
news:e0W91w4sFHA.2348@.tk2msftngp13.phx.gbl...
> Hi,
> I'm new to the ASP.NET /.NET programming so excuse my very basic question.
> I
> was trying to write the Hello World Application using ASP.Net using C# in
> Visual Studio.Net
> When I debug the application I get the error....
> "Error while trying to run project. Unable to start debugging on the web
> server. Server side-error occurred on sending debug HTTP request"
> I have checked the usual Web.config for all the flags and also made my
> Windows Domain User ID member of Debugger group etc.
> Could someone please help and tell where I should look into to solve this
> problem. This is very frustrating for me
> regards
> Bikram Suri
>
>

Server Side FieldSet?

I'm trying to write a Web Custom control that allows me to generate a set of server side text boxes inside the fieldset element. What I have is this:

protectedoverridevoid Render(HtmlTextWriter output)

{

StringBuilder sb =new StringBuilder();

//Begin the FieldSet if it's needed

if (this.ShowBorder )

sb.Append(string.Format("<fieldset style='WIDTH: {0}; HEIGHT: {1}'><legend>{2}</legend>",this.Width,this.Height,this.Legend));

//Add user controls

for(int i = 0; i <this.SearchFormFields.Length; i++)

{

SearchField curField =this.SearchFormFields[i];sb.Append(string.Format("<span class='fwifont'>{0}</span><br>", curField.Title));

//sb.Append(string.Format("<FWI:MultiRangeTextBox CssClass='fwifont' id=AccountNumberBox runat='server' TermName='{0}'></FWI:MultiRangeTextBox>", curField.TermName));

sb.Append("<asp:TextBox Runat='server' ID='fsdfd'></asp:TextBox>");

}

sb.Append("<br>");

//Finish off fieldset

if (this.ShowBorder )

sb.Append("</fieldset>");

sb.Append("<br>");

output.Write(sb.ToString());

}

However, the asp:text box does not render or show up. I'm guessing this has something to do with the fact that it's a server side control itself. Does anyone have any ideas on what I'm doing wrong here?

You are trying to output ASP control tags as markup. Would something like "<input type="text" id=......" rather the the ASP textbox control be more suitable?

Ta


Most unfortuantely, no, I cannot use html input fields. And actually, it not only needs to be a server side control, in reality it should be a custom web control that actually extends the asp:textbox class. I have a method that traverses all the controls on the web forms and handles the input of each textbox based on what "type" of server side text box it is.

Thursday, March 29, 2012

Server Side Tags and Performance <% ... %>

Do server Side tags decrease performance ... i.e.

Does it make any difference from

<% response.write "A" %
<% response.write "B" %
<% response.write "C" %
<% response.write "D" %

t

<%
response.write "A"
response.write "B"
response.write "C"
response.write "D"
%

Cheer

Mik

--
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/No, there is no perf difference. ASP.NET is a different implementation that
ASP, so many of the tips and tricks used there are not applicable in ASP.NET.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Do server Side tags decrease performance ... i.e.
> Does it make any difference from:
> <% response.write "A" %>
> <% response.write "B" %>
> <% response.write "C" %>
> <% response.write "D" %>
> to
> <%
> response.write "A"
> response.write "B"
> response.write "C"
> response.write "D"
> %>
> Cheers
> Mike
> --
> Posted using Wimdows.net Newsgroups -
> http://www.wimdows.net/newsgroups/
Thanks ... so my next question is did it make any difference in classic ap then ?

--
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Thanks ... so my next question is did it make any difference in classic asp then ?

--
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
> Thanks ... so my next question is did it make any difference in
> classic ap then ?

Heh, yes it did. The transition form static content to script blocks was
overhead. But, as I said before, ASP.NET has a different design, so they're
not affected by that issue.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Server Side Tags and Performance <% ... %>

Do server Side tags decrease performance ... i.e.
Does it make any difference from:
<% response.write "A" %>
<% response.write "B" %>
<% response.write "C" %>
<% response.write "D" %>
to
<%
response.write "A"
response.write "B"
response.write "C"
response.write "D"
%>
Cheers
Mike
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/No, there is no perf difference. ASP.NET is a different implementation that
ASP, so many of the tips and tricks used there are not applicable in ASP.NET
.
-Brock
DevelopMentor
http://staff.develop.com/ballen

> Do server Side tags decrease performance ... i.e.
> Does it make any difference from:
> <% response.write "A" %>
> <% response.write "B" %>
> <% response.write "C" %>
> <% response.write "D" %>
> to
> <%
> response.write "A"
> response.write "B"
> response.write "C"
> response.write "D"
> %>
> Cheers
> Mike
> --
> Posted using Wimdows.net Newsgroups -
> http://www.wimdows.net/newsgroups/
Thanks ... so my next question is did it make any difference in classic ap t
hen ?
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Thanks ... so my next question is did it make any difference in classic asp
then ?
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
> Thanks ... so my next question is did it make any difference in
> classic ap then ?
Heh, yes it did. The transition form static content to script blocks was
overhead. But, as I said before, ASP.NET has a different design, so they're
not affected by that issue.
-Brock
DevelopMentor
http://staff.develop.com/ballen

Saturday, March 24, 2012

Server Variable

Specifically, I am looking for a response.write variable for the version of dot.net running on a server.

But on a more general level I would like know a simply command to see all the available server variables on a server with dot.net.

Thanks !!Are you talking about the ServerVariables?
(request.ServerVariables)

There's a whole list of possible items there - - -

All you need to do is to turn on Tracing on your page, and you can see all of them at work.
Excellent --

Request.ServerVariables that is what I was looking for.

However, What does turn on tracing mean? Is that something I do like define the language?

Thanks --
To turn on tracing, go to your page's <@.page directive and add Trace="true", then run the page. You'll see what it does.

Thursday, March 22, 2012

Server.GetLastError() question.

Hi,

Does any1 can tell me how Server.GetLastError work? say i have a case where i have 2 concurrent exception thrown in, and i write a BasePage.cs to inherit into all my aspx.cs page. Then inside my BasePage.cs has a procedure called "protected override void OnError(EventArgs e)".My question is if 2 concurrent exception had occur,how does the SErver.GetlastError() know which is which?

The reason i ask this because inside my BasePage.OnError procedure i have a function to write error to my log file:


ApplicationLog.WriteError(Server.GetLastError());

and i m wondering how .NET handle this issues??

please help thank you.Well, as far as I'm aware (and note that I'm not as handy with exception handling as I'd like to be), the situation you describe can't occur--or at least is so rare that you might be concerned about Earth wobbling off its axis and wandering into Andromeda before it happens.

Is it possible for 2 errors to occur in exactly the same millisecond? Yes, I suppose so. I think, though, as a matter of 'bang for your buck' in terms of your own time spent, you might be better off to code as though you'll never see it.

Then, if by extremely remote chance it does occur, you can spend less time working out whose error is whose than you would've spent trying to anticipate the situation.

Of course, I may be all wet on this--anyone else have any comments?
u r right in away..but precaution better then cure..
anyway..i got it from unofficial source regarding Server.GetlastError();

according to him,"server.getlasterror is thread dependend" which means it "raised for the current request" and if it really happen that 2 concurrent exception is thrown,it will have "will have two different objects".

Well that was from a unofficial source..i m not sure about it i m still looking high n low about it...i spent whole nite looking for it and i m still looking..

Rgd,
Dorris
TheServer object is available from theHttpContext of each ASP.NET page request. Each page request is serviced by a single thread, available from a pool of only 25 worker threads. The chance of two out of 25 threads giving rise to a concurrent exception in the same millisecond is indeed extremely remote. (You are much more likely to cause a concurrency problem yourself, when writing to your application log.)

You might take heart from the introduction toUse Threads and Build Asynchronous Handlers in Your Server-Side Web Code:
"If you look at the documentation for ASP.NET, however, you will find very little information about threading requirements. Does this mean that all threading issues are solved and that ASP.NET developers can live carefree lives building .aspx pages and Microsoft® .NET Framework classes without cluttering their minds with concurrency issues? Well, yes, in most cases it does."

Remember that ASP.NET is a managed environment. It is designed to alleviate the need for developers to worry about most issues of threading, memory management, and so on.

I think you can leave the issue of worker threads to ASP.NET. You, the developer, have some responsibility when dealing with the IO threads ... and you should concentrate your efforts there. (In your case, reading and writing of your application log.)
Say, good answer.

So how're things down under? :)
thank you alot for the great advise.
You're welcome, Dorris.

Jeff, there's a mighty confused wanna-be developer down under ... I can't findApplication Design for Dummies in any bookstore :)
<g

Tuesday, March 13, 2012

Server.mappath

Hi,
if I write this code to retrieve a folder on the server
Server.mappath("/DATA")
I get this error message
System.InvalidOperationException: Failed to map the path '/DATA'
the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
folder that I would like to retrieve
anybody an idea
thx"benoit" wrote:

> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the
> DATA
> folder that I would like to retrieve
I doesn't need to be in Inetpub.
Is "data" the name of a folder inside your webapp? If so, shouldn't your
line read Server.mappath("/WebApp/Data") ?
Steven
- - -
Benoit,
Server.MapPath(...) works starting at the IIS Virtual directory root of the
currently running application page.
It does not work for folders anywhere outside the IIS Vroot of the current
application.
What is it that you are trying to accomplish?
Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"benoit" wrote:

> Hi,
> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the DA
TA
> folder that I would like to retrieve
> anybody an idea
> thx
Well
On ASP.NET 1.1 I had two webapps on the same server
/WNW
and
/Data
/Data was a virtual folder in which images and Xml are stored.
With Server.MapPath("/Data") i could without any problem read my Xml and
images.
Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
data the way I used to
"Peter Bromberg [C# MVP]" wrote:
> Benoit,
> Server.MapPath(...) works starting at the IIS Virtual directory root of th
e
> currently running application page.
> It does not work for folders anywhere outside the IIS Vroot of the current
> application.
> What is it that you are trying to accomplish?
> Peter
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
> "benoit" wrote:
>
"benoit" wrote:

> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to
IIRC, this is a security issue. What about putting a virtual dir in /WNW
called "Data" that points to the same location as /Data? That way you can
use Server.MapPath("/WNW/Data");
Steven
- - -
That's strange.
I can retrieve physical paths by using Server.MapPath("/virtualDir")
without any problem.
mappath.aspx:
--
<%@. Page Language="VB" %>
<script language = "VB" runat = "server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim x As String = Server.MapPath("/SomeApp")
Label1.Text = "The physical directory for /SomeApp is : " & x
End Sub
</script>
<html>
<head runat="server">
<title>Server.MapPath</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label><br/>
</div>
</form>
</body>
</html>
--
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
> Well
> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to
>
>
> "Peter Bromberg [C# MVP]" wrote:
>
I noticed that when i teste the app in the past the address
was http://localhost/MyApp/...
and now http://localhost:someport/MyApp
Does it have something to do with that?
"Juan T. Llibre" wrote:

> That's strange.
> I can retrieve physical paths by using Server.MapPath("/virtualDir")
> without any problem.
> mappath.aspx:
> --
> <%@. Page Language="VB" %>
> <script language = "VB" runat = "server">
> Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
> Dim x As String = Server.MapPath("/SomeApp")
> Label1.Text = "The physical directory for /SomeApp is : " & x
> End Sub
> </script>
> <html>
> <head runat="server">
> <title>Server.MapPath</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:Label ID="Label1" runat="server"></asp:Label><br/>
> </div>
> </form>
> </body>
> </html>
> --
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "benoit" <benoit@.discussions.microsoft.com> wrote in message
> news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
>
>
re:
> Does it have something to do with that?
Server.MapPath returns the correct physical directory regardless of whether
you use the built-in server in the VS IDE, or whether you use IIS to view th
e page.
All it needs is a valid relative URL ( a virtual path ).
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:932A4245-78F3-403C-BCDE-CC1110C31B94@.microsoft.com...
>I noticed that when i teste the app in the past the address
> was http://localhost/MyApp/...
> and now http://localhost:someport/MyApp
> Does it have something to do with that?
> "Juan T. Llibre" wrote:
>

Server.mappath

Hi,

if I write this code to retrieve a folder on the server
Server.mappath("/DATA")

I get this error message
System.InvalidOperationException: Failed to map the path '/DATA'

the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
folder that I would like to retrieve

anybody an idea

thx"benoit" wrote:

> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the
> DATA
> folder that I would like to retrieve

I doesn't need to be in Inetpub.

Is "data" the name of a folder inside your webapp? If so, shouldn't your
line read Server.mappath("/WebApp/Data") ?

Steven

- - -
Benoit,
Server.MapPath(...) works starting at the IIS Virtual directory root of the
currently running application page.
It does not work for folders anywhere outside the IIS Vroot of the current
application.

What is it that you are trying to accomplish?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

"benoit" wrote:

> Hi,
> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
> folder that I would like to retrieve
> anybody an idea
> thx
Well

On ASP.NET 1.1 I had two webapps on the same server
/WNW
and
/Data

/Data was a virtual folder in which images and Xml are stored.
With Server.MapPath("/Data") i could without any problem read my Xml and
images.
Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
data the way I used to

"Peter Bromberg [C# MVP]" wrote:

> Benoit,
> Server.MapPath(...) works starting at the IIS Virtual directory root of the
> currently running application page.
> It does not work for folders anywhere outside the IIS Vroot of the current
> application.
> What is it that you are trying to accomplish?
> Peter
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
> "benoit" wrote:
> > Hi,
> > if I write this code to retrieve a folder on the server
> > Server.mappath("/DATA")
> > I get this error message
> > System.InvalidOperationException: Failed to map the path '/DATA'
> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
> > folder that I would like to retrieve
> > anybody an idea
> > thx
"benoit" wrote:

> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to

IIRC, this is a security issue. What about putting a virtual dir in /WNW
called "Data" that points to the same location as /Data? That way you can
use Server.MapPath("/WNW/Data");

Steven

- - -
That's strange.

I can retrieve physical paths by using Server.MapPath("/virtualDir")
without any problem.

mappath.aspx:
------
<%@. Page Language="VB" %>
<script language = "VB" runat = "server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim x As String = Server.MapPath("/SomeApp")
Label1.Text = "The physical directory for /SomeApp is : " & x
End Sub
</script>
<html>
<head runat="server">
<title>Server.MapPath</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label><br/>
</div>
</form>
</body>
</html>
------

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
> Well
> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to
>
>
> "Peter Bromberg [C# MVP]" wrote:
>> Benoit,
>> Server.MapPath(...) works starting at the IIS Virtual directory root of the
>> currently running application page.
>> It does not work for folders anywhere outside the IIS Vroot of the current
>> application.
>>
>> What is it that you are trying to accomplish?
>> Peter
>>
>> --
>> Co-founder, Eggheadcafe.com developer portal:
>> http://www.eggheadcafe.com
>> UnBlog:
>> http://petesbloggerama.blogspot.com
>>
>>
>>
>>
>> "benoit" wrote:
>>
>> > Hi,
>>> > if I write this code to retrieve a folder on the server
>> > Server.mappath("/DATA")
>>> > I get this error message
>> > System.InvalidOperationException: Failed to map the path '/DATA'
>>> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
>> > folder that I would like to retrieve
>>> > anybody an idea
>>> > thx
I noticed that when i teste the app in the past the address
was http://localhost/MyApp/...
and now http://localhost:someport/MyApp

Does it have something to do with that?

"Juan T. Llibre" wrote:

> That's strange.
> I can retrieve physical paths by using Server.MapPath("/virtualDir")
> without any problem.
> mappath.aspx:
> ------
> <%@. Page Language="VB" %>
> <script language = "VB" runat = "server">
> Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
> Dim x As String = Server.MapPath("/SomeApp")
> Label1.Text = "The physical directory for /SomeApp is : " & x
> End Sub
> </script>
> <html>
> <head runat="server">
> <title>Server.MapPath</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:Label ID="Label1" runat="server"></asp:Label><br/>
> </div>
> </form>
> </body>
> </html>
> ------
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "benoit" <benoit@.discussions.microsoft.com> wrote in message
> news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
> > Well
> > On ASP.NET 1.1 I had two webapps on the same server
> > /WNW
> > and
> > /Data
> > /Data was a virtual folder in which images and Xml are stored.
> > With Server.MapPath("/Data") i could without any problem read my Xml and
> > images.
> > Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> > data the way I used to
> > "Peter Bromberg [C# MVP]" wrote:
> >> Benoit,
> >> Server.MapPath(...) works starting at the IIS Virtual directory root of the
> >> currently running application page.
> >> It does not work for folders anywhere outside the IIS Vroot of the current
> >> application.
> >>
> >> What is it that you are trying to accomplish?
> >> Peter
> >>
> >> --
> >> Co-founder, Eggheadcafe.com developer portal:
> >> http://www.eggheadcafe.com
> >> UnBlog:
> >> http://petesbloggerama.blogspot.com
> >>
> >>
> >>
> >>
> >> "benoit" wrote:
> >>
> >> > Hi,
> >> >> > if I write this code to retrieve a folder on the server
> >> > Server.mappath("/DATA")
> >> >> > I get this error message
> >> > System.InvalidOperationException: Failed to map the path '/DATA'
> >> >> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
> >> > folder that I would like to retrieve
> >> >> > anybody an idea
> >> >> > thx
>
re:
> Does it have something to do with that?

Server.MapPath returns the correct physical directory regardless of whether
you use the built-in server in the VS IDE, or whether you use IIS to view the page.

All it needs is a valid relative URL ( a virtual path ).

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:932A4245-78F3-403C-BCDE-CC1110C31B94@.microsoft.com...
>I noticed that when i teste the app in the past the address
> was http://localhost/MyApp/...
> and now http://localhost:someport/MyApp
> Does it have something to do with that?

> "Juan T. Llibre" wrote:
>> That's strange.
>>
>> I can retrieve physical paths by using Server.MapPath("/virtualDir")
>> without any problem.
>>
>> mappath.aspx:
>> ------
>> <%@. Page Language="VB" %>
>> <script language = "VB" runat = "server">
>> Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
>> Dim x As String = Server.MapPath("/SomeApp")
>> Label1.Text = "The physical directory for /SomeApp is : " & x
>> End Sub
>> </script>
>> <html>
>> <head runat="server">
>> <title>Server.MapPath</title>
>> </head>
>> <body>
>> <form id="form1" runat="server">
>> <div>
>> <asp:Label ID="Label1" runat="server"></asp:Label><br/>
>> </div>
>> </form>
>> </body>
>> </html>
>> ------
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "benoit" <benoit@.discussions.microsoft.com> wrote in message
>> news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
>> > Well
>>> > On ASP.NET 1.1 I had two webapps on the same server
>> > /WNW
>> > and
>> > /Data
>>> > /Data was a virtual folder in which images and Xml are stored.
>> > With Server.MapPath("/Data") i could without any problem read my Xml and
>> > images.
>> > Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
>> > data the way I used to
>>>>>> > "Peter Bromberg [C# MVP]" wrote:
>>> >> Benoit,
>> >> Server.MapPath(...) works starting at the IIS Virtual directory root of the
>> >> currently running application page.
>> >> It does not work for folders anywhere outside the IIS Vroot of the current
>> >> application.
>> >>
>> >> What is it that you are trying to accomplish?
>> >> Peter
>> >>
>> >> --
>> >> Co-founder, Eggheadcafe.com developer portal:
>> >> http://www.eggheadcafe.com
>> >> UnBlog:
>> >> http://petesbloggerama.blogspot.com
>> >>
>> >>
>> >>
>> >>
>> >> "benoit" wrote:
>> >>
>> >> > Hi,
>> >>> >> > if I write this code to retrieve a folder on the server
>> >> > Server.mappath("/DATA")
>> >>> >> > I get this error message
>> >> > System.InvalidOperationException: Failed to map the path '/DATA'
>> >>> >> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
>> >> > folder that I would like to retrieve
>> >>> >> > anybody an idea
>> >>> >> > thx
>>
>>
>

Server.Mappath

Hi,

What rights do I have to add if I want to write to and create files in a
directory, if I acces it through an IP adress
I already added the "ASPNET Machine Account" and the "Guest user for
Internet Connections"(IUSR) They both have full read/write acces to that
particular dir

What am I forgetting ?The most important thing you can do is *identify*
the correct account to give read/write rights to.

Save the following as identity.aspx, and run it.
--------------
<%@. Page Language="VB" %>
<%@. Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-----------

Whether you access it through an IP address, a domain name or a machinename,
running that script will tell you *exactly* which account needs the permissions.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:4BAC95E5-4D9A-4D64-9447-9F5FAFBF304C@.microsoft.com...
> Hi,
> What rights do I have to add if I want to write to and create files in a
> directory, if I acces it through an IP adress
> I already added the "ASPNET Machine Account" and the "Guest user for
> Internet Connections"(IUSR) They both have full read/write acces to that
> particular dir
> What am I forgetting ?

Server.Mappath

Hi,
What rights do I have to add if I want to write to and create files in a
directory, if I acces it through an IP adress
I already added the "ASPNET Machine Account" and the "Guest user for
Internet Connections"(IUSR) They both have full read/write acces to that
particular dir
What am I forgetting ?The most important thing you can do is *identify*
the correct account to give read/write rights to.
Save the following as identity.aspx, and run it.
---
<%@. Page Language="VB" %>
<%@. Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
--
Whether you access it through an IP address, a domain name or a machinename,
running that script will tell you *exactly* which account needs the permissi
ons.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:4BAC95E5-4D9A-4D64-9447-9F5FAFBF304C@.microsoft.com...
> Hi,
> What rights do I have to add if I want to write to and create files in a
> directory, if I acces it through an IP adress
> I already added the "ASPNET Machine Account" and the "Guest user for
> Internet Connections"(IUSR) They both have full read/write acces to that
> particular dir
> What am I forgetting ?