Duplicate folder name in URL

G

Guest

Hello,
We have a problem in our web application.
The error reported is given with in brackets []:
[
Server Error in '/AccountClient' Application.
The resource cannot be found
Description: HTTP 404. The resource you are looking for(or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable.
Please review the following URL and make sure that it is spelled correctly.
Requested URL:
/accountClient/Home/Controller/Home/Controller/Home.aspx
]
You can see the folder name "/Home/Controller/ getting repeated in the URL.
For you information the framework used is .Net framework 1.1, the web
server is
IIS 5 and OS is Win2000 server. We used .Net Remoting in our web
application.This problem is reported once in a while and not consistently
happening.

Home.aspx is the first page getting loaded after a successful authentication
in our application (after login.aspx) All the common urls used across the
applicaiton are configured in the web.config file.

We have a section called <redirects> in the web.config and under which we
have various key names. In each of these key names a URL is assigned.
For example
<add key="LoginSuccess" value="../../Home/Controller/Home.aspx" />

In login.aspx page, once if the user's authentication is validated, using a
config reader the LoginSuccess key value is fetched and the user is routed to
the home.aspx page.

This works fine in most of the case(95%). Rarely the users are getting the
error reported in the beginining.

Once if this issue is reported our IT operation persons will open the
web.config file and do a re-save. Once if they restart the application, the
application works fine for the same user who got the error before(i.e., the
home.aspx loads properly).
Can some one explain us how exactly IIS treats web.config?.

Is IIS storing the web.config in it when the application first started?. And
is it getting locked or something. Because when we resave the web.config,
this whole problem is not happening.

Thanks in advance,
Aloysius
 
S

Steven Cheng[MSFT]

Hi Aloysius,

Welcome to the ASP.NET newsgroup.

From your description, I understand you're developing an ASP.NET web
application which is using forms authentication. And after the client users
are authenticated(be valid), the login page will read a appsetting key
(named "LoginSuccess" ) from the web.config file and redirect the user to
that url (stored in the value of that appsetting key). This redirection
works mostly , however you found that it will fails in rare cases which
result to a 404 file not found error, correct? If there is anything I
missed, please feel free to let me know.

Based on my experience, this is likely a path resolving issue which could
be due to the path you used for the "LoginSuccess" URL and the approach you
used to perform the redirection. Would you provide the code you used to
perform the redirection so that I can have a look at it?

I think the web.config should not be the cause because the .net runtime
just simply read the web.config and pickup the key/value from its
"appsettings" section. We can verify this by adding code to always write
the value into eventlog or a log file each time the login page reading
that"LoginSuccess" key from web.config.

As I mentioned before that this is likely a path resolution issue, because
your "LoginSuccess" key's url value is "../../Home/Controller/Home.aspx"
which is a relative path. And such path will be resolved to different value
according to the current web request's context( the original page(which is
request)'s folder location in this web application). It is recommend that
you try using an absolute path in such scenario. For example, you can use
an absolute path which based on the IIS site root, e.g:

"/WebAppName/subdir/pagename.aspx"

"/...." means this path is an absolute path which start from IIS site root.
Such path will not be resolved as different value due to different request
context. You can use this path only for test since it is somewhat hardcoded
and not flexible enough.
Another means to produce an absolute path is using code to generate a path,
the Page class has a "ResolveUrl" method this can help resolve a ASP.NET
awared server-side path to its correct (client browser awared path). For
example:

"~/subdir/pagename.aspx"

the above path usually means an absolute path which start from ASP.NET web
application's root directory. Normally this path is only used by ASP.NET
Server Control, such as

<asp:Image ImageUrl="~/Images/image.gif" .... />

However, we can use code to programmatically resolve such server-side path.
e.g:

string cilentPath = Page.ResolveUrl("~/Images/image.gif")

Therefore, you can also consider using this means to resolve the absolute
url in your login page's redirection code. And the value stored in
web.config could be "~/ ...." style path.

In addition, you can ask your server admin to check the IIS log (especially
the log entires associated with those problem requests). We can find the
complete requests' path redirection process in the log entries and these
are usually helpful.


Hope this helps some. If there is anything unclear, please feel free to
post here.


Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
S

Steven Cheng[MSFT]

Hi Aloysius,

How are you doing on this issue, have you got any progress on this or does
my last reply helps some on this?

If there is any thing unclear in my last message or anything else we can
help, please feel free to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi Steven,
Sorry for my late reply. Actually we were trying out few options in our
environment and it consumed bit more time.
Your reply really helped me a lot it approaching the problem in a systamatic
way.
As I mentioned earlier, the problem is happening only in production and not
replicable in local testing/development environment. So we decided to track
the URL string passed in all the redirection methods used in our application
(like response.redirect, server.transfer, HyperLink.NavigateURL etc). This
can help us in deciding whether the problem is at application level or at
environment level( can be IIS).
As per your inputs, we decided to introduce site root relative path(using ~/
instead of ../../) only for Home.aspx redirections. As this problem is
frequently reported in this page redirection, we took this page for our
analysis. If the problem is not reported over a period of time we will
implement the site root relative path instead of relative path for all our
redirections.

I hope this problem will get over soon.
Again thanks for your inputs and suggestions. I will update you soon when I
get a reply from our customers.

Thanks and Regards,
Aloysius
 
S

Steven Cheng[MSFT]

Thanks for your followup Aloysius,

I'm glad that the information is of assistance. As we're closely monitoring
the thread, please feel free to post here if you need any further help.

Good luck & Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top